当前位置: 首页>>代码示例>>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;未经允许,请勿转载。