Android Context Get getHelpUrl(Context context, String s)

Here you can find the source of getHelpUrl(Context context, String s)

Description

get Help Url

Declaration

public static Uri getHelpUrl(Context context, String s) 

Method Source Code

//package com.java2s;
import java.util.Locale;
import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;

public class Main {
    public static Uri getHelpUrl(Context context, String s) {
        if (TextUtils.isEmpty(s))
            throw new IllegalArgumentException(
                    "getHelpUrl(): fromWhere must be non-empty");
        String s1 = "http://www.google.com/support/mobile/?hl=%locale%";
        if (s1.contains("%locale%")) {
            Locale locale = Locale.getDefault();
            s1 = s1.replace(// w  w  w  .ja v  a 2  s. c o  m
                    "%locale%",
                    (new StringBuilder()).append(locale.getLanguage())
                            .append("-")
                            .append(locale.getCountry().toLowerCase())
                            .toString());
        }
        android.net.Uri.Builder builder = Uri.parse(s1).buildUpon();
        builder.appendQueryParameter("p", s);
        try {
            builder.appendQueryParameter(
                    "version",
                    String.valueOf(context
                            .getPackageManager()
                            .getPackageInfo(
                                    context.getApplicationInfo().packageName,
                                    0).versionCode));
        } catch (android.content.pm.PackageManager.NameNotFoundException namenotfoundexception) {
            Log.e("HelpUrl", (new StringBuilder("Error finding package "))
                    .append(context.getApplicationInfo().packageName)
                    .toString());
        }
        return builder.build();
    }
}

Related

  1. getExternalCacheDir(Context context)
  2. getExternalCacheDir(Context context)
  3. getFAFont(Context context)
  4. getFiles(Context context, String ext)
  5. getFromAssets(Context con, String fileName)
  6. getImei(Context context, String imei)
  7. getInstalleApps(Context mContext)
  8. getInstance(Context context)
  9. getIntSPR(String key, Context context)