Kayıtlar

Uri etiketine sahip yayınlar gösteriliyor

Open URL/Website from android

String url = "http://almondmendoza.com/android-applications/"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i);

Verify that Intent can be launched

// TODO (1) Create a method called openWebPage that accepts a String as a parameter // Do steps 2 - 4 within openWebPage     // TODO (2) Use Uri.parse to parse the String into a Uri     // TODO (3) Create an Intent with Intent.ACTION_VIEW and the webpage Uri as parameters      // TODO (4) Verify that this Intent can be launched and then call startActivity public void openWebPage(String url){      Uri uri = Uri. parse (url);      Intent intent = new Intent(Intent. ACTION_VIEW ,uri);      if(intent.resolveActivity(getPackageManager()) != null){          startActivity(intent);      } } When you call  startActivity()  or  startActivityForResult()  and pass it an implicit intent, the system  resolves the intent  to an app that can handle the intent and starts its corresponding  Ac...

Github query URL (using Uri) and get the response data in Android

/* These utilities will be used to communicate with the network.*/ public class NetworkUtils { final static String GITHUB_BASE_URL = "https://api.github.com/search/repositories" ; final static String PARAM_QUERY = "q" ; /** The sort field. Default: results are sorted by best match * if no field is specified. */ final static String PARAM_SORT = "sort" ; final static String sortBy = "stars" ; /** * Builds the URL used to query Github. * @param githubSearchQuery The keyword that will be queried for. * @return The URL to use to query the weather server. */ public static URL buildUrl(String githubSearchQuery) { // To build the proper Github query URL Uri builtUri = Uri. parse ( GITHUB_BASE_URL ) .buildUpon() .appendQueryParameter( PARAM_QUERY ,githubSearchQuery) .appendQueryPara...