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

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

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

Intent.makeMainActivity介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

@Override
 public Intent getIntentForActivity(Class<? extends Activity> activityClass) {
  Intent intent = Intent.makeMainActivity(new ComponentName(getTargetContext(), activityClass));
  if (getTargetContext().getPackageManager().resolveActivity(intent, 0) != null) {
   return intent;
  }
  return Intent.makeMainActivity(new ComponentName(getContext(), activityClass));
 }
}

代码示例来源:origin: lingochamp/FileDownloader

private NotificationItem(int id, String title, String desc) {
  super(id, title, desc);
  Intent[] intents = new Intent[2];
  intents[0] = Intent.makeMainActivity(new ComponentName(DemoApplication.CONTEXT,
      MainActivity.class));
  intents[1] = new Intent(DemoApplication.CONTEXT, NotificationSampleActivity.class);
  this.pendingIntent = PendingIntent.getActivities(DemoApplication.CONTEXT, 0, intents,
      PendingIntent.FLAG_UPDATE_CURRENT);
  builder = new NotificationCompat.
      Builder(FileDownloadHelper.getAppContext());
  builder.setDefaults(Notification.DEFAULT_LIGHTS)
      .setOngoing(true)
      .setPriority(NotificationCompat.PRIORITY_MIN)
      .setContentTitle(getTitle())
      .setContentText(desc)
      .setContentIntent(pendingIntent)
      .setSmallIcon(R.mipmap.ic_launcher);
}

代码示例来源:origin: lingochamp/FileDownloader

private NotificationItem(int id, String title, String desc) {
  super(id, title, desc);
  Intent[] intents = new Intent[2];
  intents[0] = Intent.makeMainActivity(new ComponentName(DemoApplication.CONTEXT,
      MainActivity.class));
  intents[1] = new Intent(DemoApplication.CONTEXT, NotificationSampleActivity.class);
  this.pendingIntent = PendingIntent.getActivities(DemoApplication.CONTEXT, 0, intents,
      PendingIntent.FLAG_UPDATE_CURRENT);
  builder = new NotificationCompat.
      Builder(FileDownloadHelper.getAppContext());
  builder.setDefaults(Notification.DEFAULT_LIGHTS)
      .setOngoing(true)
      .setPriority(NotificationCompat.PRIORITY_MIN)
      .setContentTitle(getTitle())
      .setContentText(desc)
      .setContentIntent(pendingIntent)
      .setSmallIcon(R.mipmap.ic_launcher);
}

代码示例来源:origin: org.robolectric/robolectric

@Override
 public Intent getIntentForActivity(Class<? extends Activity> activityClass) {
  Intent intent = Intent.makeMainActivity(new ComponentName(getTargetContext(), activityClass));
  if (getTargetContext().getPackageManager().resolveActivity(intent, 0) != null) {
   return intent;
  }
  return Intent.makeMainActivity(new ComponentName(getContext(), activityClass));
 }
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static Intent makeMainActivity(ComponentName mainActivity) {
  return Intent.makeMainActivity(mainActivity);
}

相关文章

Intent类方法