How to Invoke or call one app from another app in Android?

前端 未结 3 1290
星月不相逢
星月不相逢 2021-01-27 08:07

I want to invoke one application from another application.

My Java file code:

Intent intent = new Intent(Intent.ACTION_RUN);
intent.se         


        
3条回答
  •  时光说笑
    2021-01-27 08:24

    Starting an external activity from your app is done using a slightly different method to that which you are using. You need to create an intent with a given action. For example, launching an intent to fetch an image from the gallery would look like this:

    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    startActivityForResult(intent, IMAGE_PICK);
    

    Note that you don't explicitly define the activity to be loaded, rather the kind of action you want to perform. Android will then pick (or have the user pick) an activity that has registered to handle this kind of intent to be run.

提交回复
热议问题