Tag: android-activity

onActivityResult not call in the Fragment

The structure of the app is like this: tabHost (in Activity) -> contains -> TabFragment(extend base container fragment) 1. The code in Activity: tabHost.addTab( tabHost.newTabSpec(“home”).setIndicator(“”, getResources().getDrawable(R.drawable.btn_home)), HomeFragment.class, null); 2. The code in HomeFragment (Notice that HomeFragment is not the actual function but a container like this, and it extend BaseContainerFragment): public class HomeFragment extends BaseContainerFragment […]

finish() not closing activity when called after the first run

I have three activities MessagesAttachPhotoActivity MessageGalleryFolderSelectorActivity ImagePickerActivity MessagesAttachPhotoActivity calls MessageGalleryFolderSelectorActivity with startActivityForResult(). MessageGalleryFolderSelectorActivity activity displays the photo folders on the phone and one selects a folder. ImagePickerActivity is then called with setActivityForResult(). Once an image is selected from ImagePickerActivity, it is passed back to MessagesAttachPhotoActivity via MessageGalleryFolderSelectorActivity. When I run the app for the first […]

Trying to UNINSTALL_SHORTCUT but shortcut won't go away

I created a test Activity that installs a shortcut of itself on the Android Home screen. When you click a button, the Activity is supposed to remove the same shortcut it just created. However, nothing I do seems to delete the shortcut. Here is the Java code (ShortcutTest.java): import java.net.URISyntaxException; import android.app.Activity; import android.content.Context; import […]

Android Activity with Transparent Layout

I wish to create a activity that look like a popup window That is with transparent background for activity als i wish to show it in custom position on scree that is on right corner of device screen what i did was inside onCreate of pop over like activty Display display = getWindow().getWindowManager().getDefaultDisplay(); WindowManager.LayoutParams params […]

ACTION_SEND used to send sms

I want to open native application to send sms but there should be already phone number. I found ACTION_SEND but when I’m calling my function it’s return error that: 04-26 11:59:15.991: ERROR/AndroidRuntime(20198): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO (has extras) } My code presented here: private void smsSend(String number) { Intent intent […]

Prevent android from recreating activity stack after crash

I have an application that is encountering an exception in an activity a few levels down the stack. I am also using ACRA for crash reporting in status bar notifications + dialog mode. What I see happening is that when my process is killed because of the exception, Android recreates the activity stack upto the […]

Android ClassCast exception when binding to service

Ok, I’m new to android development and am trying to bind to a service so that I can call methods on the service once it’s been started. The Activity and Service described below are both part of the same application so there shouldn’t be any problems there, but everytime I run my app I get […]

Passing Integer Between Activities and Intents in Android Is Always Resulting in Zero / Null

I’m attempting to pass two integers from my Main Page activity (a latitude and longitude) to a second activity that contains an instance of Google Maps that will place a marker at the lat and long provided. My conundrum is that when I retrieve the bundle in the Map_Page activity the integers I passed are […]

Updating textview on activity once data in adapter class is changed

I am having textview txtQuantity in my dashboard activity. I wrote separate class for custom adapter which will contain sold products. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashboard); list = (ListView) findViewById(R.id.listSoldItems); txtAmount = (TextView) findViewById(R.id.txtAmount); txtItems = (TextView) findViewById(R.id.txtItems); // init listview adapter = new Sold_item_adaptor(Dashboard.this, soldItemsList); list.setAdapter(adapter); I can remove items from list […]

How to align center the title or label in activity?

I know there are two ways of setting the title of activity. One way is the setting it in the android manifest like this android:label=”@string/app_name”. Second is programmatically setting in activity class like setTitle(“Hello World!”). Both ways are positioned in the left side but how can I put it in the center?

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.