How to get a list of installed android applications and pick one to run

I asked a similar question to this earlier this week but I’m still not understanding how to get a list of all installed applications and then pick one to run. I’ve tried: Intent intent = new Intent(ACTION_MAIN); intent.addCategory(CATEGORY_LAUNCHER); and this only shows application that are preinstalled or can run the ACTION_MAIN Intent type. I also … Read more

How to use putExtra() and getExtra() for string data

Can someone please tell me how exactly to use getExtra() and putExtra() for intents? Actually I have a string variable, say str, which stores some string data. Now, I want to send this data from one activity to another activity. Intent i = new Intent(FirstScreen.this, SecondScreen.class); String keyIdentifer = null; i.putExtra(strName, keyIdentifer ); and then … Read more

How to make a phone call using intent in Android?

I’m using the following code to make a call in Android but it is giving me security exception please help. posted_by = “111-333-222-4”; String uri = “tel:” + posted_by.trim() ; Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(uri)); startActivity(intent); permissions <uses-permission android:name=”android.permission.CALL_PHONE” /> Exception 11-25 14:47:01.661: ERROR/AndroidRuntime(302): Uncaught handler: thread main exiting due to uncaught exception 11-25 … Read more

How do I get the currently displayed fragment?

I am playing with fragments in Android. I know I can change a fragment by using the following code: FragmentManager fragMgr = getSupportFragmentManager(); FragmentTransaction fragTrans = fragMgr.beginTransaction(); MyFragment myFragment = new MyFragment(); //my custom fragment fragTrans.replace(android.R.id.content, myFragment); fragTrans.addToBackStack(null); fragTrans.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); fragTrans.commit(); My question is, in a Java file, how can I get the currently displayed Fragment … Read more