INTENT

Intent is an object in android that contains data that allows various components of App to communicate.

intent

Intent can be passed by two methods :

1.Implicit Intent : This intent allows other app to open specific component from another app. This is achieved through intent filter. We specify action and category for that particular component which we want to be accessible by other apps installed in device.

2.Explicit Intent : Specify the component which has to be started. Used to invoke the component of the same App . eg.

Intent i=new Intent(ActivityOne.this, ActivityTwo.class);
i.putExtra("key",value);
startActivity(i);

Bundle : We can put data in Bundle and Bundle in Intent, and then pass data from one Activity to another.


Intent i=new Intent(ActivityOne.this , ActivityTwo.class);
Bundle b=new Bundle();
b.putString("key" , "data");
i.putExtra("keyBundle",b);

Leave a comment