當前位置: 首頁>>代碼示例>>Java>>正文


Java Uri.fromParts方法代碼示例

本文整理匯總了Java中android.net.Uri.fromParts方法的典型用法代碼示例。如果您正苦於以下問題:Java Uri.fromParts方法的具體用法?Java Uri.fromParts怎麽用?Java Uri.fromParts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.net.Uri的用法示例。


在下文中一共展示了Uri.fromParts方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startDialPhoneNumber

import android.net.Uri; //導入方法依賴的package包/類
@Override
public void startDialPhoneNumber(String number) {
    Intent phoneIntent = new Intent(Intent.ACTION_DIAL, Uri.fromParts(
            "tel", number, null));
    if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
        if (((TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE))
                .getSimState() == TelephonyManager.SIM_STATE_READY) {
            if (Settings.Global.getInt(getContext().getContentResolver(),
                    Settings.Global.AIRPLANE_MODE_ON, 0) == 0) {
                startActivity(phoneIntent);
                return;
            }
        }
    }
    Snackbar.make(phoneTextView, R.string.calls_unavailable_error, Snackbar.LENGTH_SHORT).show();
}
 
開發者ID:ukevgen,項目名稱:BizareChat,代碼行數:17,代碼來源:UserInfoFragment.java

示例2: getSettingsIntent

import android.net.Uri; //導入方法依賴的package包/類
@NonNull private Intent getSettingsIntent(String packageName) {
  Intent intent = new Intent();
  intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
  Uri uri = Uri.fromParts("package", packageName, null);
  intent.setData(uri);
  return intent;
}
 
開發者ID:Arjun-sna,項目名稱:android-permission-checker-app,代碼行數:8,代碼來源:AppDetailsFragment.java

示例3: notifyAppUninstalled

import android.net.Uri; //導入方法依賴的package包/類
private void notifyAppUninstalled(AppSetting setting) {
    int N = mRemoteCallbackList.beginBroadcast();
    while (N-- > 0) {
        try {
            mRemoteCallbackList.getBroadcastItem(N).onRemoveApp(setting.packageName);
        } catch (RemoteException e) {
            // Ignore
        }
    }
    mRemoteCallbackList.finishBroadcast();
    Intent virtualIntent = new Intent(Constants.ACTION_PACKAGE_REMOVED);
    Uri uri = Uri.fromParts("package", setting.packageName, null);
    virtualIntent.setData(uri);
    for (int userId : VUserManagerService.get().getUserIds()) {
        Intent intent = new Intent(virtualIntent);
        intent.putExtra(Intent.EXTRA_UID, VUserHandle.getUid(userId, setting.appId));
        VirtualCore.get().getContext().sendBroadcast(virtualIntent);
    }
    VAccountManagerService.get().refreshAuthenticatorCache(null);
}
 
開發者ID:codehz,項目名稱:container,代碼行數:21,代碼來源:VAppManagerService.java

示例4: onOptionsItemSelected

import android.net.Uri; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.android_settings) {

        // FIXME Clearing the cache, Just for debug.
        /*final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);

        VolleyUtils.getBitmapCache().resize(1);
        VolleyUtils.getBitmapCache().resize(maxMemory / 8);*/
        return true;
    }
    else   if (item.getItemId() == R.id.contact_developer) {
        if(StringUtils.isNotEmpty(BDefines.ContactDeveloper_Email))
        {
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
                    "mailto", BDefines.ContactDeveloper_Email, null));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, BDefines.ContactDeveloper_Subject);
            startActivity(Intent.createChooser(emailIntent, BDefines.ContactDeveloper_DialogTitle));
        }
        return true;
    }

    return super.onOptionsItemSelected(item);
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:25,代碼來源:ChatSDKMainActivity.java

示例5: setSendMail

import android.net.Uri; //導入方法依賴的package包/類
private void setSendMail()
{
	String[] recipient = {"[email protected]"};
	String balises = getStringSrc(R.string.mail_default);
	String sous_sujet = getStringSrc(R.string.app_name) + ": " + balises;

	Intent email = new Intent(Intent.ACTION_SEND, Uri.fromParts("mailto", "[email protected]", "null"));
	email.setType("text/plain");
	email.putExtra(Intent.EXTRA_EMAIL, recipient);
	email.putExtra(Intent.EXTRA_SUBJECT, sous_sujet);
	email.putExtra(Intent.EXTRA_TEXT, edit.getText().toString());
	try
	{
		startActivity(Intent.createChooser(email, getStringSrc(R.string.toast_mail_choose_plarforme)));
	} 

	catch (ActivityNotFoundException ex)
	{
		Preferences.longToast(ActivityContact.this, getStringSrc(R.string.toast_mail_send_failed));
	}
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:22,代碼來源:ActivityContact.java

示例6: showInstalledAppDetails

import android.net.Uri; //導入方法依賴的package包/類
/**
     * app 設置
     *
     * @param context     c
     * @param packageName pn
     */
    public static void showInstalledAppDetails(Context context, String packageName) {
        Intent intent = new Intent();
        final int apiLevel = Build.VERSION.SDK_INT;
        if (apiLevel >= 9) { // 2.3(ApiLevel 9)以上,使用SDK提供的接口
            intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
            Uri uri = Uri.fromParts(SCHEME, packageName, null);
            intent.setData(uri);
        } else { // 2.3以下,使用非公開的接口(查看InstalledAppDetails源碼)
// 2.2和2.1中,InstalledAppDetails使用的APP_PKG_NAME不同。
            final String appPkgName = (apiLevel == 8 ? APP_PKG_NAME_22
                    : APP_PKG_NAME_21);
            intent.setAction(Intent.ACTION_VIEW);
            intent.setClassName(APP_DETAILS_PACKAGE_NAME,
                    APP_DETAILS_CLASS_NAME);
            intent.putExtra(appPkgName, packageName);
        }
        context.startActivity(intent);
    }
 
開發者ID:abook23,項目名稱:godlibrary,代碼行數:25,代碼來源:AndroidUtils.java

示例7: openClearAppUI

import android.net.Uri; //導入方法依賴的package包/類
/**
 * 打開包名packageName的清理界麵
 * @param context
 * @param packageName
 */
public static void openClearAppUI(Context context,String packageName){
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", packageName, null);
    intent.setData(uri);
    context.startActivity(intent);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:13,代碼來源:AceHelper.java

示例8: sendFeedback

import android.net.Uri; //導入方法依賴的package包/類
private void sendFeedback(){
    Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
            Uri.fromParts("mailto", getString(R.string.mailto),null));
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.subject));
    startActivity(Intent.createChooser(emailIntent, getString(R.string.sendchooser_text)));

}
 
開發者ID:cahergil,項目名稱:Farmacias,代碼行數:8,代碼來源:MainActivity.java

示例9: contactUs

import android.net.Uri; //導入方法依賴的package包/類
public static void contactUs(Activity activity) {
    AboutConfig config = AboutConfig.getInstance();

    final Uri mailto = Uri.fromParts("mailto", config.emailAddress, null);

    String emailBody = config.emailBody;
    if (TextUtils.isEmpty(emailBody)) {
        String deviceInfo = "";
        deviceInfo += "\n App version: " + config.version;
        deviceInfo += "\n Android version: " + Build.VERSION.RELEASE + " (" + android.os.Build.VERSION.SDK_INT + ")";
        deviceInfo += "\n Device: " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")";
        deviceInfo += "\n Platform: " + platformName(config.buildType);

        emailBody = activity.getString(R.string.egab_email_body_prompt) + "\n\n\n\n\n"
                + "---------------------------" + deviceInfo;
    }

    try {
        Intent emailIntent = new Intent(Intent.ACTION_SENDTO, mailto);
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, config.emailSubject);
        emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody);
        activity.startActivity(Intent.createChooser(emailIntent, "Send email..."));
    } catch (Exception e) {
        if (config.analytics != null) {
            config.analytics.logException(e, false);
        }
    }
}
 
開發者ID:eggheadgames,項目名稱:android-about-box,代碼行數:29,代碼來源:EmailUtil.java

示例10: uninstallApp

import android.net.Uri; //導入方法依賴的package包/類
public static void uninstallApp(Context context, String packageName) {
	try {
		Uri packageUri = Uri.fromParts("package", packageName, null);
		if(packageUri != null){
			Intent intentUninstall = new Intent(Intent.ACTION_DELETE, packageUri);
			intentUninstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intentUninstall);
		}
	} catch (Exception e) { }
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:11,代碼來源:PackageManagerUtils.java

示例11: loadPermissionPage

import android.net.Uri; //導入方法依賴的package包/類
private void loadPermissionPage(Activity context) {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", context.getPackageName(), null);
    intent.setData(uri);
    context.startActivityForResult(intent, 0);
}
 
開發者ID:KingsMentor,項目名稱:Rationale,代碼行數:8,代碼來源:RationaleDialog.java

示例12: showAppDetailsForProfile

import android.net.Uri; //導入方法依賴的package包/類
public void showAppDetailsForProfile(ComponentName component, UserHandleCompat user) {
    String packageName = component.getPackageName();
    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
            Uri.fromParts("package", packageName, null));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |
            Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    mContext.startActivity(intent, null);
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:9,代碼來源:LauncherAppsCompatV16.java

示例13: openSettings

import android.net.Uri; //導入方法依賴的package包/類
public static void openSettings(Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
    intent.setData(uri);
    activity.startActivity(intent);
}
 
開發者ID:hypertrack,項目名稱:service-visit-example-android,代碼行數:8,代碼來源:PermissionUtils.java

示例14: contactUsSelected

import android.net.Uri; //導入方法依賴的package包/類
private void contactUsSelected() {
    final Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                                          Uri.fromParts("mailto", Constants.CONTACT_US_EMAIL, null));
    startActivity(Intent.createChooser(emailIntent, getString(R.string.label_send_email)));
}
 
開發者ID:ZafraniTechLLC,項目名稱:Companion-For-PUBG-Android,代碼行數:6,代碼來源:DrawerActivity.java

示例15: navigateToSettingsScreen

import android.net.Uri; //導入方法依賴的package包/類
/**
 * Opens settings screen of the application. This method must be used <strong>only</strong> if
 * you show some confirmation in {@link #showExplanationOnNever()}, which should indicate further
 * user actions
 */
protected void navigateToSettingsScreen() {
    final Intent intent = new Intent(
            Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
            Uri.fromParts("package", appContext().getPackageName(), null)
    );
    startActivityForResult(intent, requestCode);
}
 
開發者ID:noties,項目名稱:Requirements,代碼行數:13,代碼來源:PermissionCase.java


注:本文中的android.net.Uri.fromParts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。