![]() ![]() ![]() ![]() The Intent Resolver parses through a list of Activities and chooses the one that would best match your Intent, in this case, the Web Browser Activity. For this purpose, your Activity will send ACTION_WEB_SEARCH Intent to the Android Intent Resolver to open given URL in the web browser. StartActivity(Intent.createChooser(email, "Choose an email client from.")) Ībove syntax is calling startActivity method to start an email activity and result should be as shown below −įor example, assume that you have an Activity that needs to open URL in a web browser on your Android device. Intent email = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:")) Įmail.putExtra(Intent.EXTRA_EMAIL, recipients) Įmail.putExtra(Intent.EXTRA_SUBJECT, subject.getText().toString()) Įmail.putExtra(Intent.EXTRA_TEXT, body.getText().toString()) The specified chooser gives the proper interface for the user to pick how to send your email data. For this purpose, your Activity would send an ACTION_SEND along with appropriate chooser, to the Android Intent Resolver. ![]() The intent itself, an Intent object, is a passive data structure holding an abstract description of an operation to be performed.įor example, let's assume that you have an Activity that needs to launch an email client and sends an email using your Android device. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service. An Android Intent is an abstract description of an operation to be performed. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |