本文整理汇总了Java中android.content.Intent.setClass方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.setClass方法的具体用法?Java Intent.setClass怎么用?Java Intent.setClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.setClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMissingSubtitles
import android.content.Intent; //导入方法依赖的package包/类
protected void getMissingSubtitles(boolean force,ArrayList<String> allVideoPaths, ArrayList<String> missingSubVideoPaths){
ArrayList<String> videoPaths;
if(!force)
videoPaths = missingSubVideoPaths;
else
videoPaths = allVideoPaths;
if (videoPaths.isEmpty()&&!force){
mDialogForceDlSubtitles = new DialogForceDlSubtitles();
Bundle args = new Bundle();
args.putSerializable(SubtitlesDownloaderActivity.FILE_URLS, allVideoPaths);
mDialogForceDlSubtitles.setArguments(args);
mDialogForceDlSubtitles.show(getFragmentManager(), null);
}else {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClass(mContext, SubtitlesDownloaderActivity.class);
intent.putExtra(SubtitlesDownloaderActivity.FILE_URLS, videoPaths);
startActivity(intent);
}
}
示例2: startNBADetailActivity
import android.content.Intent; //导入方法依赖的package包/类
private void startNBADetailActivity(String id, String imgUrl, View view) {
Intent intent = new Intent();
intent.setClass(getActivity(), NBAActivity.class);
intent.putExtra("id", id);
intent.putExtra("url", imgUrl);
/**
* 用这个ActivityOptionsCompat比用ActivityOptions兼容性更好,前者是V4下的兼容到16后者到21.
* ActivityOptionsCompat.makeSceneTransitionAnimation()的第三个参数则是跳转后图片显示的transitionName的值
* <android.support.design.widget.AppBarLayout
android:transitionName="zhihu_detail_title"
android:fitsSystemWindows="true">
*/
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
view, getActivity().getResources().getString(R.string.zhihu_detail_title));
getActivity().startActivity(intent, options.toBundle());
}
示例3: gotoLockViewActivity
import android.content.Intent; //导入方法依赖的package包/类
/**
* Go to lock activity.
*/
private void gotoLockViewActivity()
{
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setClass(this, LockViewActivity.class);
intent.setAction(LockViewActivity.ACTION_LOCK_DECODE);
startActivity(intent);
finish();
}
示例4: gotoGirlDetail
import android.content.Intent; //导入方法依赖的package包/类
public void gotoGirlDetail(String url,String id) {
Intent intent = new Intent();
intent.setClass(mContext, GirlDetailActivity.class);
intent.putExtra("url",url);
intent.putExtra("id",id);
mContext.startActivity(intent);
}
示例5: comeOnBaby
import android.content.Intent; //导入方法依赖的package包/类
public static void comeOnBaby(Context context) {
if (context != null) {
Intent intent = new Intent();
intent.setClass(context, SportCourseChangeActivity.class);
context.startActivity(intent);
}
}
示例6: getIntent
import android.content.Intent; //导入方法依赖的package包/类
/**
* Get {@link CropImageActivity} intent to start the activity.
*/
public Intent getIntent(@NonNull Context context, @Nullable Class<?> cls) {
mOptions.validate();
Intent intent = new Intent();
intent.setClass(context, cls);
intent.putExtra(CROP_IMAGE_EXTRA_SOURCE, mSource);
intent.putExtra(CROP_IMAGE_EXTRA_OPTIONS, mOptions);
return intent;
}
示例7: notifyDownloadStart
import android.content.Intent; //导入方法依赖的package包/类
/**
* 开始下载
*
* @param context
* @param title
* @param icon
*/
private void notifyDownloadStart(Context context, Request request)
{
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.api_download_notification);
remoteViews.setProgressBar(R.id.noti_progressBar, PROGRESSBAR_MAX, 0, false);
remoteViews.setImageViewResource(R.id.noti_icon, R.drawable.notification_remote_icon);
remoteViews.setTextViewText(R.id.noti_file_name, request.mTitle);
String host = CommonUtils.getHost(request.mDownloadUrl);
if (CommonUtils.isWo2bHost(request.mDownloadUrl))
{
remoteViews.setTextViewText(R.id.noti_progressBarLeft, "www.wo2b.com");
}
else
{
remoteViews.setTextViewText(R.id.noti_progressBarLeft, host);
}
// 执行取消操作的PendingIntent, 向DownloadService发起取消下载的命令
Intent cancelIntent = new Intent();
cancelIntent.setClass(context, DownloadService.class);
cancelIntent.putExtra(DownloadService.EXTRA_EVENT_TYPE, DownloadService.EVENT_CANCEL);
cancelIntent.putExtra(DownloadService.EXTRA_DOWNLOAD_URL, request.mDownloadUrl);
PendingIntent cancelPendingIntent = PendingIntent.getService(context, 100, cancelIntent,
PendingIntent.FLAG_CANCEL_CURRENT);
remoteViews.setOnClickPendingIntent(R.id.noti_cancel, cancelPendingIntent);
// 消息信息设置
Notification notification = new Notification();
notification.tickerText = request.mTitle;
notification.icon = R.drawable.notification_icon;
notification.contentView = remoteViews;
// notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.flags = Notification.FLAG_ONGOING_EVENT;
// 点击通知栏
Intent intent = new Intent();
intent.setAction("com.wo2b.download.AActivity");
// intent.setClass(context, Download.class);
notification.contentIntent = PendingIntent.getActivity(context, 1, intent, PendingIntent.FLAG_CANCEL_CURRENT);
// 生成通知ID
int notificationId = new Random().nextInt(10000);
mNotificationManager.notify(notificationId, notification);
request.mNotification = notification;
request.mNotificationId = notificationId;
}
示例8: innerStartActivity
import android.content.Intent; //导入方法依赖的package包/类
private static boolean innerStartActivity(Context context, Mapping mapping, Uri uri, String url, boolean isDeeplink)
{
if(mapping.getTargetActivity() == null) return false;
Intent intent = new Intent();
intent.setClass(context, mapping.getTargetActivity());
intent.setData(uri);
intent.putExtras(mapping.parseExtras(url));
if(!(context instanceof Activity))
{
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
context.startActivity(intent);
ActivityRoutingStatus activityRoutingStatus = mActivityRoutingStatusMap.get(mapping.getTargetActivity());
if(activityRoutingStatus == null)
{
mActivityRoutingStatusMap.put(mapping.getTargetActivity(), new ActivityRoutingStatus(isDeeplink, mapping.getParentActivityHost()));
}
else
{
activityRoutingStatus.isActivityLinkedByDeeplink = true;
}
return true;
}
示例9: actionReschedulePoll
import android.content.Intent; //导入方法依赖的package包/类
public static void actionReschedulePoll(Context context, Integer wakeLockId) {
Intent i = new Intent();
i.setClass(context, MailService.class);
i.setAction(MailService.ACTION_RESCHEDULE_POLL);
addWakeLockId(context, i, wakeLockId, true);
Utils.startServicePossiblyInForeground(context, i);
}
示例10: gotoWelcomeActivity
import android.content.Intent; //导入方法依赖的package包/类
/**
* Go to guide activity.
*/
private void gotoWelcomeActivity()
{
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setClass(this, WelcomeActivity.class);
startActivity(intent);
finish();
}
示例11: startActivityForResult
import android.content.Intent; //导入方法依赖的package包/类
/**
* [含有Bundle通过Class打开编辑界面]
*
* @param clz 要跳转的Activity
* @param bundle bundel数据
* @param requestCode requestCode
*/
public void startActivityForResult(Class<?> clz, Bundle bundle,
int requestCode) {
Intent intent = new Intent();
intent.setClass(this, clz);
if (bundle != null) {
intent.putExtras(bundle);
}
startActivityForResult(intent, requestCode);
if (isTransAnim)
overridePendingTransition(R.anim.activity_start_zoom_in, R.anim
.activity_start_zoom_out);
}
示例12: onClick
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tag_a_photo:
Intent photoToBeTagged = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(photoToBeTagged, CHOOSE_A_PHOTO_TO_BE_TAGGED);
break;
case R.id.see_tagged_photos:
if (!InstaTagSampleApplication.getInstance().getTaggedPhotos().isEmpty()) {
Intent taggedPhotos = new Intent();
taggedPhotos.setClass(InstaActivity.this, TaggedPhotoActivity.class);
startActivity(taggedPhotos);
} else {
Toast.makeText(this, NO_PHOTO_TAGGED, Toast.LENGTH_SHORT).show();
}
break;
case R.id.see_some_ones:
Intent someOnes = new Intent();
someOnes.setClass(InstaActivity.this, SomeOneActivity.class);
startActivity(someOnes);
break;
case R.id.drag_test:
Intent dragTest = new Intent();
dragTest.setClass(InstaActivity.this, DragTestActivity.class);
startActivity(dragTest);
break;
default:
break;
}
}
示例13: onClick
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onClick() {
Intent intent = new Intent();
intent.setClass(this, ScreenCaptureActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityAndCollapse(intent);
}
示例14: start
import android.content.Intent; //导入方法依赖的package包/类
public static void start(Context context, String id) {
Intent intent = new Intent();
intent.putExtra("id", id);
intent.setClass(context, VideoDetailActivity.class);
context.startActivity(intent);
}
示例15: start
import android.content.Intent; //导入方法依赖的package包/类
public static void start(Context context, String tid) {
Intent intent = new Intent();
intent.putExtra(EXTRA_ID, tid);
intent.setClass(context, AdvancedTeamInfoActivity.class);
context.startActivity(intent);
}