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

后端 未结 7 1325
感动是毒
感动是毒 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:25

    Implicit intent doesn't specify the component. Intent provides the information of a component

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

    whereas, Explicit intent specify the component. The intent provides information about the class.

     Intent i = new Intent(this, ClassB.class);  
     startActivity(i); 
    

提交回复
热议问题