Advertisement
Online Test Banks
Score higher
See Online Test Banks
eLearning
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

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 activity startActivity(new Intent(this, Destination.class));
Create a chooser Intent.createChooser(yourIntent, "Please Select");
Open the Web browser Intent i = new
Intent(Intent.ACTION_VIEW,
Uri.parse("http://example.org"));
startActivity(i);
Start activity for a result startActivityForResult(yourIntent, YOUR_REQUEST_CODE);
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win an iPad Mini. Enter to win now!