本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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);
}
示例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));
}
}
示例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);
}
示例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);
}
示例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)));
}
示例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);
}
}
}
示例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) { }
}
示例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);
}
示例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);
}
示例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);
}
示例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)));
}
示例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);
}