1. Intent helps to jump from one Activity to anther Activity
2. Create a Single Page Application with a Single Page (Activity)
3. Create another Page, i.e., Second Page (Second Activity)
4. Intent is an object which requests an Action from another object
5. Explicit Intent: Communicates between two activities within the same application
6. Implicit Intent: Communicates between two activities from two different applications
7. Intents are used to
1. Start activity
2. Start services
3. Broadcasting Message
4. Pass information
The Code
StartActivity(i);
Here intent is an object of type intent.
This code is to be written in MainActivity.java file within setOnClickListener()Intent intent = new Intent(MainActivity.this, BrowseActivity.class );
startActivity(intent);The complete CodeBlock Goes Herebtn_payment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, BrowseActivity.class );
startActivity(intent);
}
});Here is a detailed YouTube Video to guide you through the process of creating intent the right way.
PS: When calling from Adapter, use
Intent intent = new Intent(v.getContext(), ComplaintDetailActivity.class);
Comments
Post a Comment