-1

IDE: Eclipse, java, Android

Hi, I have 2 android applications App1, App2. In App1 I have created a button and on clicking this button I want to launch another android application.

//For performing this i have created button and a event Code is below btnotherAppLaunch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent mIntent = new Intent("com.example.addsubtract"); } }); 

Here addsubtract is my simple App2.
When i am clicking on button nothing is happening. pls suggest what i am missing I am new in android app development

2
  • plz do google first, its very basic stackoverflow.com/questions/736571 Commented Feb 21, 2014 at 17:32
  • It is basic, but your link is about Activities, not Apps. Commented Feb 21, 2014 at 17:38

1 Answer 1

0

Try this way (may need to replace getActivity() with whatever is appropriate to the place you are calling (like MainActivity.this or something)):

PackageManager pm = getActivity().getPackageManager(); Intent it = pm.getLaunchIntentForPackage("com.example.addsubtract"); getActivity().startActivity(it); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.