Android Intent Create callHTTPDownload(Context context, String chooserTilte, String url)

Here you can find the source of callHTTPDownload(Context context, String chooserTilte, String url)

Description

call HTTP Download

License

Open Source License

Declaration

public static void callHTTPDownload(Context context,
            String chooserTilte, String url) 

Method Source Code

//License from project: Open Source License 

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Looper;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.WindowManager;
import android.webkit.URLUtil;

public class Main{
    public static void callHTTPDownload(Context context,
            String chooserTilte, String url) {
        if (null == context) {
            return;
        }//ww  w. j  a  v a  2  s.c o m
        // update v2
        Intent intent = new Intent(Intent.ACTION_VIEW);
        //      intent.setAction(Intent.ACTION_VIEW);
        //      intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setData(Uri.parse(URLUtil.guessUrl(url)));
        //      intent.setDataAndType(Uri.parse(URLUtil.guessUrl(url)), "text/html");

        try {
            context.startActivity(Intent
                    .createChooser(intent, chooserTilte).addFlags(
                            Intent.FLAG_ACTIVITY_NEW_TASK));
        } catch (Exception e) {
            ToastUtil.showToast(context, "exception");
        }
    }
}

Related

  1. callPhone(Context context, String number)
  2. constructGoogleCalendarIntentVariant1()
  3. constructGoogleCalendarIntentVariant2()
  4. createNotification(Intent resultIntent, Context current, final Class destination)