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.orangelabs.rcs.ri.messaging.chat.single.SingleChatView.java

/**
 * Forge intent to start SingleChatView activity
 * /*from   w  w w  .  j  a v  a 2  s . c  o  m*/
 * @param ctx The context
 * @param contact The contact ID
 * @param intent intent
 * @return intent
 */
public static Intent forgeIntentOnStackEvent(Context ctx, ContactId contact, Intent intent) {
    intent.setClass(ctx, SingleChatView.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(EXTRA_CONTACT, (Parcelable) contact);
    return intent;
}

From source file:com.ppshein.sevendaynews.common.java

public static Intent reDirect(String tabName, Context ctx) {
    Intent intent = null;
    if (tabName.equals("Home")) {
        common.setMyStringPref(ctx, "NULL");
        intent = new Intent();
        intent.setClass(ctx, MainActivity.class);
        return intent;
    } else if (tabName.equals("Business")) {
        common.setMyStringPref(ctx, tabName);
        intent = new Intent();
        intent.setClass(ctx, MainActivity.class);
        return intent;
    } else if (tabName.equals("Entertainment")) {
        common.setMyStringPref(ctx, tabName);
        intent = new Intent();
        intent.setClass(ctx, MainActivity.class);
        return intent;
    } else if (tabName.equals("Health")) {
        common.setMyStringPref(ctx, tabName);
        intent = new Intent();
        intent.setClass(ctx, MainActivity.class);
        return intent;
    } else if (tabName.equals("Science")) {
        common.setMyStringPref(ctx, tabName);
        intent = new Intent();
        intent.setClass(ctx, MainActivity.class);
        return intent;
    } else if (tabName.equals("Sports")) {
        common.setMyStringPref(ctx, tabName);
        intent = new Intent();
        intent.setClass(ctx, MainActivity.class);
        return intent;
    } else if (tabName.equals("World")) {
        common.setMyStringPref(ctx, tabName);
        intent = new Intent();
        intent.setClass(ctx, MainActivity.class);
        return intent;
    } else if (tabName.equals("Sync")) {
        intent = new Intent();
        intent.setClass(ctx, Sync.class);
        return intent;
    } else if (tabName.equals("About")) {
        intent = new Intent();
        intent.setClass(ctx, About.class);
        return intent;
    }//from   w  ww  . j  a v  a 2 s.  c  o  m
    return intent;
}

From source file:com.oo58.game.texaspoker.AppActivity.java

public static void QQ_Logon() {
    Intent intent_pay = new Intent();
    intent_pay.setClass(mContext, LoginActivity.class);
    mContext.startActivity(intent_pay);//from   w w  w .ja v a2 s  .co  m
}

From source file:com.oo58.game.texaspoker.AppActivity.java

public static void WX_Logon() {
    Intent intent_pay = new Intent();
    intent_pay.setClass(mContext, WEIXINLogin.class);
    mContext.startActivity(intent_pay);/*from  ww w .  j  av a  2s  . c  o m*/
}

From source file:com.oo58.game.texaspoker.AppActivity.java

/**
 * /*  w w  w  . j ava2  s.com*/
 */
public static void callTakePhoto() {
    AppActivity appAct = (AppActivity) mAct;
    Intent intent = new Intent();
    intent.setClass(appAct, PhotoManagerActivity.class);

    intent.putExtra("fun", "takephoto");
    appAct.startActivityForResult(intent, REQUSET);
}

From source file:com.oo58.game.texaspoker.AppActivity.java

/**
 * /*from  w w  w .  j av  a  2  s  . com*/
 */
public static void callPhotoalbum() {

    AppActivity appAct = (AppActivity) mAct;
    Intent intent = new Intent();
    intent.setClass(appAct, PhotoManagerActivity.class);

    intent.putExtra("fun", "photoalbum");
    appAct.startActivityForResult(intent, REQUSET);

}

From source file:com.nuvolect.securesuite.main.SharedMenu.java

public static void sharedOnRequestPermissionsResult(Activity act, int requestCode, String[] permissions,
        int[] grantResults) {

    switch (requestCode) {

    /**/*from w ww. ja  v  a2 s .com*/
     * Service the result of a permission request
     */
    case CConst.IMPORT_VCARD_REQUEST_EXTERNAL_STORAGE: {

        // If request is cancelled, the result arrays are empty.
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

            // Kickoff a browser activity here.
            // When user selects file, onActivityResult called with the result.
            Intent intent = new Intent();
            intent.setClass(act, FileBrowserImportVcf.class);
            act.startActivityForResult(intent, CConst.IMPORT_VCARD_BROWSE_ACTION);
        } else {

            Toast.makeText(act, "Sorry, external storage permission required for import", Toast.LENGTH_SHORT)
                    .show();
        }
        break;
    }
    case CConst.IMPORT_SINGLE_CONTACT_REQUEST_READ: {
        /**
         * Launch the contact picker intent.
         * Results returned in onActivityResult()
         */
        Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
        m_act.startActivityForResult(contactPickerIntent, CConst.IMPORT_SINGLE_CONTACT_PICKER);
        break;
    }
    case CConst.IMPORT_ACCOUNT_CONTACTS_REQUEST_READ_CONTACTS: {

        // If request is cancelled, the result arrays are empty.
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

            CloudImportDialog.openDialog(act);

        } else {

            Toast.makeText(m_act, "Sorry, read contacts permission required for import", Toast.LENGTH_SHORT)
                    .show();
        }
        break;
    }
    case CConst.CALLER_ID_REQUEST_READ_PHONE_STATE:
        // If request is cancelled, the result arrays are empty.
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

            // Do nothing
            //                    Toast.makeText(m_act, "Caller identification enabled", Toast.LENGTH_SHORT).show();

        } else {

            Toast.makeText(m_act, "Calls will not be identified without Read Phone State", Toast.LENGTH_SHORT)
                    .show();
        }
        break;
    case CConst.REQUEST_WRITE_EXTERNAL_STORAGE:
        // If request is cancelled, the result arrays are empty.
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

            // Do nothing
        } else {
            Toast.makeText(m_act, "App will be unable to save files to external storage", Toast.LENGTH_SHORT)
                    .show();
        }
        break;
    default: {

        LogUtil.log("SharedMenu sharedOnRequestPermissionResult UNMANAGED/ERROR requestCode: " + requestCode);

        for (int i = 0; i < permissions.length; i++)
            LogUtil.log("SharedMenuUtil permissions: " + permissions[i] + "  " + grantResults[i]);

    }
    }
}

From source file:com.orangelabs.rcs.ri.messaging.chat.group.GroupChatView.java

/**
 * Forge intent to notify new Group Chat
 *
 * @param ctx The context./*from  w w  w . j av  a2 s .  com*/
 * @param invitation The original intent.
 * @return intent
 */
public static Intent forgeIntentInvitation(Context ctx, Intent invitation) {
    invitation.setClass(ctx, GroupChatView.class);
    invitation.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    invitation.putExtra(GroupChatView.EXTRA_MODE, GroupChatMode.INCOMING);
    return invitation;
}

From source file:com.orangelabs.rcs.ri.messaging.chat.group.GroupChatView.java

/**
 * Forge intent to notify Group Chat message
 *
 * @param ctx The context./*from  www . j  a v a  2 s.com*/
 * @param newgroupChatMessage The original intent.
 * @param chatId the chat ID
 * @return intent
 */
public static Intent forgeIntentNewMessage(Context ctx, Intent newgroupChatMessage, String chatId) {
    newgroupChatMessage.setClass(ctx, GroupChatView.class);
    newgroupChatMessage.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    newgroupChatMessage.putExtra(GroupChatView.EXTRA_MODE, GroupChatMode.INCOMING);
    newgroupChatMessage.putExtra(GroupChatIntent.EXTRA_CHAT_ID, chatId);
    return newgroupChatMessage;
}

From source file:com.oo58.game.texaspoker.AppActivity.java

public static void Mobile_pay(String order_id, String money, String name, int type) {
    Log.i("lvjian", "order_id--------" + order_id);
    Log.i("lvjian", "money--------" + money);
    Log.i("lvjian", "name---------" + name);
    if (type == 0) {
        Intent intent_pay = new Intent();
        intent_pay.putExtra("order_id", order_id);
        intent_pay.putExtra("money", money);
        intent_pay.setClass(mContext, UniPaying.class);
        mContext.startActivity(intent_pay);
    } else if (type == 1) {
        Intent intent_pay = new Intent();
        intent_pay.putExtra("order_id", order_id);
        intent_pay.putExtra("money", money);
        intent_pay.putExtra("name", name);
        intent_pay.setClass(mContext, AliPaying.class);
        mContext.startActivity(intent_pay);
    } else if (type == 2) { // WeiXin Pay

        Message msg = mVideoHandler.obtainMessage();
        msg.what = 2001;//from w w  w . j a  va  2 s .  c  om
        msg.obj = order_id;
        mVideoHandler.sendMessage(msg);
    }

}