1

Thanks to every on to support android development forum. I want to make a application where when I click a button in my application then open android built-in Calculator application.

That means I want to call calculator apk file from my application. Is it possible?

Advanced thanks to reply

skaffman
  • 398,947
  • 96
  • 818
  • 769
Jobayer
  • 11
  • 1
  • 2

2 Answers2

1

Check this Tutorial

Intent i = new Intent();
i.setClassName("com.android.calculator2",
               "com.android.calculator2.Calculator");
startActivity(i); 

the above works for HTC only

 i.setClassName("com.sec.android.app.popupcalculator",
                   "com.sec.android.app.popupcalculator.Calculator");

the above works for S3

but may not work for some Phones.

Then see this Answer

Community
  • 1
  • 1
Xar-e-ahmer Khan
  • 1,314
  • 15
  • 23
0

I have find out the following step:

  1. Create an intent with action=MAIN and category=LAUNCHER
  2. Get the PackageManager from the current context using context.getPackageManager
  3. packageManager.queryIntentActivity(, 0) where intent has category=LAUNCHER, action=MAIN or packageManager.resolveActivity(, 0) to get the first activity with main/launcher
  4. Get the ActivityInfo you're interested in
  5. From the ActivityInfo, get the packageName and name
  6. Finally, create another intent with with category=LAUNCHER, action=MAIN, componentName = new ComponentName(packageName, name) and setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
  7. Finally, context.startActivity(newIntent)

But I am confused about the packageName and className of buit-in calculator application.Would u known about those information pls reply me ASAP.

Thanks to all

Jobayer
  • 11
  • 1
  • 2