What is the different between Explicit and implicit activity call in android?

后端 未结 7 1313
感动是毒
感动是毒 2020-12-01 03:11

What is the difference between explicit and implicit activity call in android? If you explain the answer with a simple example will be good.

7条回答
  •  离开以前
    2020-12-01 03:15

    For example:

    implicit activity call

    In intent filter you create action for you activity, so other app can call your activity via this action as following:

    
       
          
          
           
       
    
    

    And the other way to call implicit Intent is below:

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com"));
    startActivity(intent);
    

    Explicit activity call

    You make a call that indicate exactly which activity class:

    Intent intent = new Intent(this, ActivityABC.class);
    intent.putExtra("Value", "This value for ActivityABC");
    startActivity(intent);
    

    Hope this help you understand more about Explicit and implicit activity call in android.

    You can get more detail about Android Intent here

提交回复
热议问题