Example usage for android.content Intent setClass

List of usage examples for android.content Intent setClass

Introduction

In this page you can find the example usage for android.content Intent setClass.

Prototype

public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls) 

Source Link

Document

Convenience for calling #setComponent(ComponentName) with the name returned by a Class object.

Usage

From source file:com.meet.ychmusic.activity.PhotoDetailsActivity.java

public static Intent createIntent(Context context, String item) {
    String[] array = { item };//from   ww w.  j a v  a 2 s.  c  om
    Intent intent = new Intent();
    intent.setClass(context, PhotoDetailsActivity.class);
    intent.putExtra("album", array);
    intent.putExtra("index", 0);
    return intent;
}

From source file:com.kymjs.gallery.KJGalleryActivity.java

public static void toGallery(Context cxt, int index, String... urls) {
    if (!StringUtils.isEmpty(urls)) {
        Intent intent = new Intent();
        intent.putExtra(KJGalleryActivity.URL_INDEX, index);
        intent.putExtra(KJGalleryActivity.URL_KEY, urls);
        intent.setClass(cxt, KJGalleryActivity.class);
        cxt.startActivity(intent);// w  w  w . java2s . c o  m
    }
}

From source file:com.facebook.internal.DialogPresenter.java

public static void setupAppCallForErrorResult(AppCall appCall, FacebookException exception) {
    if (exception == null) {
        return;/*from  w  w w .  j a v a  2 s . c om*/
    }
    Validate.hasFacebookActivity(FacebookSdk.getApplicationContext());

    Intent errorResultIntent = new Intent();
    errorResultIntent.setClass(FacebookSdk.getApplicationContext(), FacebookActivity.class);
    errorResultIntent.setAction(FacebookActivity.PASS_THROUGH_CANCEL_ACTION);

    NativeProtocol.setupProtocolRequestIntent(errorResultIntent, appCall.getCallId().toString(), null,
            NativeProtocol.getLatestKnownVersion(), NativeProtocol.createBundleForException(exception));

    appCall.setRequestIntent(errorResultIntent);
}

From source file:com.ariesmcrae.mymemories.ui.story.StoryActivityBase.java

public static Intent newListStoryIntent(Activity activity) {
    Intent intent = new Intent();
    intent.setClass(activity, StoryListActivity.class);
    return intent;
}

From source file:com.ariesmcrae.mymemories.ui.story.StoryActivityBase.java

public static Intent newCreateStoryIntent(Activity activity) {
    Intent intent = new Intent();
    intent.setClass(activity, CreateStoryActivity.class);
    return intent;
}

From source file:com.ariesmcrae.mymemories.ui.story.StoryActivityBase.java

public static Intent newEditStoryIntent(Activity activity, long index) {
    Intent intent = new Intent();
    intent.setClass(activity, EditStoryActivity.class);
    intent.putExtra(EditStoryFragment.rowIdentifyerTAG, index);
    return intent;
}

From source file:com.ariesmcrae.mymemories.ui.story.StoryActivityBase.java

/*************************************************************************/

public static Intent newStoryViewIntent(Activity activity, long index) {
    Intent intent = new Intent();
    intent.setClass(activity, ViewStoryActivity.class);
    intent.putExtra(StoryViewFragment.rowIdentifyerTAG, index);
    return intent;
}

From source file:com.apptentive.android.sdk.module.messagecenter.ApptentiveMessageCenter.java

protected static void show(Activity activity) {
    SharedPreferences prefs = activity.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE);
    Configuration conf = Configuration.load(activity);
    boolean enableMessageCenter = conf.isMessageCenterEnabled(activity);
    boolean emailRequired = conf.isMessageCenterEmailRequired(activity);
    boolean shouldShowIntroDialog = !enableMessageCenter
            || prefs.getBoolean(Constants.PREF_KEY_MESSAGE_CENTER_SHOULD_SHOW_INTRO_DIALOG, true);
    // TODO: What if there is an incoming message that is unread? Shouldn't they see the Message Center right away?
    if (shouldShowIntroDialog) {
        showIntroDialog(activity, emailRequired);
    } else {//  www.  j  a v  a2  s. com
        Intent intent = new Intent();
        intent.setClass(activity, ViewActivity.class);
        intent.putExtra(ActivityContent.KEY, ActivityContent.Type.MESSAGE_CENTER.toString());
        activity.startActivity(intent);
        activity.overridePendingTransition(R.anim.slide_up_in, R.anim.slide_down_out);
    }
}

From source file:com.yutong.axxc.parents.view.common.ActivityUtils.java

/**
 * @param vMonitorBatchActivity TODO//www  . ja  v  a2 s  . c  om
 * @param from ?activity
 * @param to biactivity
 * @param vBeanList ??
 */
public static void changeActivityWithData(Activity from, Class<?> to, Intent mIntent) {
    if (mIntent != null) {
        mIntent.setClass(from, to);
        from.startActivity(mIntent);
    }
}

From source file:com.aqtx.app.main.activity.MainActivity.java

public static void start(Context context, Intent extras) {
    Intent intent = new Intent();
    intent.setClass(context, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    if (extras != null) {
        intent.putExtras(extras);//from  www  .  ja v a2  s . co  m
    }
    context.startActivity(intent);
}