Question

I'd like to display the system/default calculator using Fragment, it's like embedding the calculator in the ActivityFragment. The reason for this for multitasking. I have this code below that opens an Intent for the calculator but the UI of it occupies the whole screen. I want the system calc to use just half of the screen while I can use the other half for another Fragment.

public void launchCalculator() {

        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        intent.setComponent(new ComponentName(CALCULATOR_PACKAGE_NAME,
               CALCULATOR_CLASS_NAME));
       try {
           this.startActivity(intent);

       } catch (ActivityNotFoundException noSuchActivity) {
           // handle exception where calculator intent filter is not registered
       }

    } 
Était-ce utile?

La solution

  1. There is no "Default calculator" in Android.
  2. You can't embed separate app into your app.

Such functionality should be implemented in the system. Some of new phones/tablets from Samsung have similar functionality but it's proprietary implementation and you can't use it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top