The example below assumes that you are on the Photo Gallery Activity, and want to view a specific photo (which would open in its own activity). To simplify this, let us once again take a similar example of the Facebook app. Here one Activity uses Intent to request the launch of another Activity. Thus, it is evident that using intents, one Android component can request action from the other components of Android. While you are interacting with one activity, you might want to switch to another one this is done by defining a proper Intent for the action.Activities, Services and Broadcast Receivers. They are commands which when called would act as communicators between the three core components of Android, i.e.It is a description of what you want done, example: VIEW VIDEO, PLAY GAME etc. Think of intent as a message to communicate an action.This Android tutorial would discuss a few deeper concepts associated with the topic. So, we assume that you understand a little about Android Intent. When you click on the photo, the intent associated with the click event of photo is fired which communicates the message, and the Photo page opens (which is a new Activity). Suppose you are on the news feed screen (which is one Activity), and want to view a pic posted by our friend. In our Android tutorial covering fresher interview questions, we had explained the usage of Intent in Facebook with the following example: Watch this video to get an overview of Intent.
0 Comments
Leave a Reply. |