Example usage for android.net Uri parse

List of usage examples for android.net Uri parse

Introduction

In this page you can find the example usage for android.net Uri parse.

Prototype

public static Uri parse(String uriString) 

Source Link

Document

Creates a Uri which parses the given encoded URI string.

Usage

From source file:Main.java

public static Uri bitmap2Uri(final Context context, final Bitmap bitmap) {
    return context == null || bitmap == null ? null
            : Uri.parse(MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, null, null));
}

From source file:Main.java

public static void openDeveloperPageOnGooglePlay(Context context, String pubName) {
    try {/*from  ww  w  . j a  v  a 2s .c o m*/
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("market://search?q=pub:" + pubName));
        context.startActivity(intent);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void openApplicationOnGooglePlay(Context context, String packageName) {
    try {//w  w  w.  ja va 2  s .c o m
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("market://details?id=" + packageName));
        context.startActivity(intent);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static boolean openUrlSchema(Context context, String uri) {
    try {/*  w  ww  .  j  av a  2s.co m*/
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
        context.startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return true;
}

From source file:Main.java

public static void clearDefaultBrowser(Context context, String packgeName) {
    Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
            Uri.parse("package:" + packgeName));
    context.startActivity(intent);/*  w w  w . j a  va  2  s  .co  m*/
}

From source file:Main.java

public static Intent getYoutubeTrailerIntent(String videoKey) {
    Uri videoUri = Uri.parse(YOUTUBE_PLAY_BASE_URL).buildUpon()
            .appendQueryParameter(YOUTUBE_VIDEO_KEY_PARAM, videoKey).build();
    return new Intent(Intent.ACTION_VIEW, videoUri);
}

From source file:Main.java

public static void startPhone(Context context, String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    // intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    context.startActivity(intent);/*from  w  w w. jav a  2 s. c  o  m*/
}

From source file:Main.java

public static void openDefaultBrowser(Context context, String url) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    Uri content_url = Uri.parse(url);
    intent.setData(content_url);/*from  w w  w.j a va  2s. com*/
    context.startActivity(intent);
}

From source file:Main.java

public static Intent getAndroidImageShareIntent(CharSequence chooseTitle, String pathfile) {
    Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("image/*");
    share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathfile));
    return Intent.createChooser(share, chooseTitle);
}

From source file:Main.java

public static void downApkFromBrowser(Context context, String strUrl) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");

    Uri uri = Uri.parse(strUrl);
    intent.setData(uri);// w  ww. ja  v a2s .co  m

    context.startActivity(intent);
}