當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.setClass方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:21,代碼來源:Browser.java

示例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());
}
 
開發者ID:paterWang,項目名稱:EasyReader,代碼行數:17,代碼來源:NBAFragment.java

示例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();
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:14,代碼來源:SplashActivity.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:LikeAdapter.java

示例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);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:SportCourseChangeActivity.java

示例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;
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:13,代碼來源:CropImage.java

示例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;

}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:60,代碼來源:DownloadService.java

示例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;
}
 
開發者ID:kfrozen,項目名稱:DeeplinkRouter,代碼行數:33,代碼來源:DPRouter.java

示例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);
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:8,代碼來源:MailService.java

示例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();
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:13,代碼來源:SplashActivity.java

示例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);
}
 
開發者ID:Horrarndoo,項目名稱:YiZhi,代碼行數:20,代碼來源:BaseCompatActivity.java

示例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;
    }
}
 
開發者ID:harsh159357,項目名稱:InstaTag,代碼行數:32,代碼來源:InstaActivity.java

示例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);
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:8,代碼來源:ScreenCaptureTile.java

示例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);
}
 
開發者ID:Longalei,項目名稱:Edu,代碼行數:7,代碼來源:VideoDetailActivity.java

示例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);
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:7,代碼來源:AdvancedTeamInfoActivity.java


注:本文中的android.content.Intent.setClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。