android.content.Intent.setComponent()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(339)

本文整理了Java中android.content.Intent.setComponent()方法的一些代码示例,展示了Intent.setComponent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.setComponent()方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:setComponent

Intent.setComponent介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);

代码示例来源:origin: Flipboard/bottomsheet

public Intent getConcreteIntent(Intent intent) {
    Intent concreteIntent = new Intent(intent);
    concreteIntent.setComponent(componentName);
    return concreteIntent;
  }
}

代码示例来源:origin: stackoverflow.com

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.example", "com.example.MyExampleActivity"));
startActivity(intent);

代码示例来源:origin: JessYanCoding/MVPArms

public static boolean openAppActivity(Context context, String packageName,
                   String activityName) {
  Intent intent = new Intent(Intent.ACTION_MAIN);
  intent.addCategory(Intent.CATEGORY_LAUNCHER);
  ComponentName cn = new ComponentName(packageName, activityName);
  intent.setComponent(cn);
  try {
    context.startActivity(intent);
    return true;
  } catch (Exception e) {
    return false;
  }
}

代码示例来源:origin: stackoverflow.com

final String packageName = res.activityInfo.packageName;
  final Intent intent = new Intent(captureIntent);
  intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
  intent.setPackage(packageName);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
  cameraIntents.add(intent);
final Intent galleryIntent = new Intent();
galleryIntent.setType("image/*");
galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()]));

代码示例来源:origin: android-hacker/VirtualXposed

private Intent makeMyIntent() {
  Intent intent = new Intent(getIntent());
  intent.setComponent(null);
  intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
  return intent;
}

代码示例来源:origin: stackoverflow.com

String url = "http://www.example.com";
 try {
   Intent i = new Intent("android.intent.action.MAIN");
   i.setComponent(ComponentName.unflattenFromString("com.android.chrome/com.android.chrome.Main"));
   i.addCategory("android.intent.category.LAUNCHER");
   i.setData(Uri.parse(url));
   startActivity(i);
 }
 catch(ActivityNotFoundException e) {
   // Chrome is probably not installed
 }

代码示例来源:origin: Tencent/tinker

private void storeAndReplaceOriginalComponentName(Intent intent, String origPackageName, String origClassName, String stubClassName) {
  final ComponentName origComponentName = new ComponentName(origPackageName, origClassName);
  ShareIntentUtil.fixIntentClassLoader(intent, mContext.getClassLoader());
  intent.putExtra(EnvConsts.INTENT_EXTRA_OLD_COMPONENT, origComponentName);
  final ComponentName stubComponentName = new ComponentName(origPackageName, stubClassName);
  intent.setComponent(stubComponentName);
}

代码示例来源:origin: stackoverflow.com

Intent internetIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.google.com"));
internetIntent.setComponent(new ComponentName("com.android.browser","com.android.browser.BrowserActivity"));
internetIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(internetIntent);

代码示例来源:origin: stackoverflow.com

ActivityInfo activity=launchable.activityInfo;
ComponentName name=new ComponentName(activity.applicationInfo.packageName,
                   activity.name);
Intent i=new Intent(Intent.ACTION_MAIN);

i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
      Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
i.setComponent(name);

startActivity(i);

代码示例来源:origin: stackoverflow.com

otherAppActivity.name
    );
rateIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
rateIntent.setComponent(componentName);
context.startActivity(rateIntent);
marketFound = true;

代码示例来源:origin: stackoverflow.com

Intent intent = new Intent(Intent.ACTION_MAIN);
 intent.setComponent(ComponentName.unflattenFromString("com.google.android.maps.mytracks/com.google.android.apps.mytracks.MyTracks"));
 intent.addCategory(Intent.CATEGORY_LAUNCHER);
 startActivity(intent);

代码示例来源:origin: aa112901/remusic

@Override
  public void onReceive(Context context, Intent intent) {

//        if (MusicPlayer.isPlaying()) {
    Intent activityIntent = new Intent(context.getApplicationContext(), PlayingActivity.class);
    activityIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
    context.getApplicationContext().startActivity(activityIntent);
    Intent intent1 = new Intent();
    intent1.setComponent(new ComponentName("com.wm.remusic", "com.wm.remusic.activity.PlayingActivity.class"));
    context.sendBroadcast(intent1);
//        }

  }

代码示例来源:origin: naman14/Timber

private final PendingIntent retrievePlaybackAction(final String action) {
  final ComponentName serviceName = new ComponentName(this, MusicService.class);
  Intent intent = new Intent(action);
  intent.setComponent(serviceName);
  return PendingIntent.getService(this, 0, intent, 0);
}

代码示例来源:origin: stackoverflow.com

Resources resources = getResources();
Intent emailIntent = new Intent();
emailIntent.setAction(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(resources.getString(R.string.share_email_native)));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, resources.getString(R.string.share_email_subject));
emailIntent.setType("message/rfc822");
    emailIntent.setPackage(packageName);
  } else if(packageName.contains("twitter") || packageName.contains("facebook") || packageName.contains("mms") || packageName.contains("android.gm")) {
    Intent intent = new Intent();
    intent.setComponent(new ComponentName(packageName, ri.activityInfo.name));
    intent.setAction(Intent.ACTION_SEND);
    intent.setType("text/plain");
    if(packageName.contains("twitter")) {
      intent.putExtra(Intent.EXTRA_TEXT, resources.getString(R.string.share_twitter));
    } else if(packageName.contains("facebook")) {

代码示例来源:origin: stackoverflow.com

Intent it = new Intent("intent.my.action");
it.setComponent(new ComponentName(context.getPackageName(), MyMainActivity.class.getName()));
it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.getApplicationContext().startActivity(it);

代码示例来源:origin: Tencent/tinker

@Override
void enqueueWork(Intent work) {
  Intent intent = new Intent(work);
  intent.setComponent(mComponentName);
  if (DEBUG) Log.d(TAG, "Starting service for work: " + work);
  if (mContext.startService(intent) != null) {
    synchronized (this) {
      if (!mLaunchingService) {
        mLaunchingService = true;
        if (!mServiceProcessing && mLaunchWakeLock != null) {
          // If the service is not already holding the wake lock for
          // itself, acquire it now to keep the system running until
          // we get this work dispatched.  We use a timeout here to
          // protect against whatever problem may cause it to not get
          // the work.
          mLaunchWakeLock.acquire(60 * 1000);
        }
      }
    }
  }
}

代码示例来源:origin: android-hacker/VirtualXposed

intent.setComponent(new ComponentName(getHostContext(), ChooserActivity.class));
intent.putExtra(Constants.EXTRA_USER_HANDLE, userId);
intent.putExtra(ChooserActivity.EXTRA_DATA, options);
intent.putExtra(ChooserActivity.EXTRA_WHO, resultWho);
intent.putExtra(ChooserActivity.EXTRA_REQUEST_CODE, requestCode);
return method.invoke(who, args);

代码示例来源:origin: jokermonn/permissions4m

@Override
  public Intent settingIntent() throws Exception {
    Intent intent = new Intent();
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(PACK_TAG, context.getPackageName());
    ComponentName comp;
    comp = new ComponentName(PKG, MANAGER_OUT_CLS);
    // do not work!!
//        comp = new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission" + ".PermissionAppAllPermissionActivity");
    intent.setComponent(comp);

    return intent;
  }
}

代码示例来源:origin: aa112901/remusic

private final PendingIntent retrievePlaybackAction(final String action) {
  final ComponentName serviceName = new ComponentName(this, MediaService.class);
  Intent intent = new Intent(action);
  intent.setComponent(serviceName);
  return PendingIntent.getService(this, 0, intent, 0);
}

相关文章

Intent类方法