-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

yogeshkmrsoni01
  • 663
  • 1
  • 7
  • 9

1 Answers1

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);
tritop
  • 1,655
  • 2
  • 18
  • 30