![]() ![]() You can write in one line when creating the Intent instance like below: Intent intent = new Intent(Intent.ACTION_VIEW, Uri. If the result is null, you should not use the intent and, if possible, you should disable the feature that invokes the intent. If the result is non-null, there is at least one app that can handle the intent and it's safe to call startActivity(). To first verify that an app exists to receive the intent, call resolveActivity() on your Intent object. If there are no apps on the device that can receive the implicit intent, your app will crash when it calls startActivity(). You can pass instance to the 2nd parameter, and a new Intent is created based on the given data url.Īnd then, simply call startActivity(Intent intent) to start a new Activity, which is bundled with the Intent with the given URL. ![]() Please have a look at the constructor of Intent: public Intent (String action, Uri uri) ** * Open a web page of a specified URL * * url URL to open */ public void openWebPage(String url) How it works You can see the official sample from Android Developer. The message passed between components such as activities, content providers, broadcast receivers, services, etc, is what the Android Intent is. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |