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.
























Intent Code
Start an activitystartActivity(new Intent(this, Destination.class));
Create a chooserIntent.createChooser(yourIntent, "Please Select");
Open the Web browserIntent i = new
Intent(Intent.ACTION_VIEW,
Uri.parse("http://example.org"));
startActivity(i);
Start activity for a resultstartActivityForResult(yourIntent, YOUR_REQUEST_CODE);







dummies

Source:http://www.dummies.com/how-to/content/common-android-intent-usage0.html

No comments:

Post a Comment