Common Android Intent Usage
An Intent object in Android is, well, exactly that: an intent. The best way to think about intents is to envision turning on a light with a light switch. Your intent is to turn on the light, and to do so, you perform the action of flipping the switch to the On position. In Android, this correlates to creating an instance of the Intent class with an Action in it specifying that the light is to be turned on. Although Android uses many different intents, a few are common enough that you’ll use them all the time when you’re developing apps. These are listed in the table below.
|Start an activity||startActivity(new Intent(this, Destination.class));|
|Create a chooser||Intent.createChooser(yourIntent, "Please Select");|
|Open the Web browser||Intent i = new
|Start activity for a result||startActivityForResult(yourIntent, YOUR_REQUEST_CODE);|