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.microsoft.mimickeralarm.ringing.AlarmWakeReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    Log.d(TAG, "Broadcast from AlarmManager received!");
    Intent serviceIntent = new Intent(AlarmRingingService.ACTION_DISPATCH_ALARM);
    serviceIntent.setClass(context, AlarmRingingService.class);
    serviceIntent.putExtras(intent);//from w  w w  .ja  v a2 s  .co m
    startWakefulService(context, serviceIntent);
}

From source file:com.gnufabio.costituzione.fragments.ListsFragment.java

void showDetails(int index) {
    mCurCheckPosition = index;/*from   w w  w  .  j av  a  2 s.  co m*/

    if (mDualPane) {
        //getListView().setItemChecked(index, true);

        SubListsFragment details = (SubListsFragment) getActivity().getSupportFragmentManager()
                .findFragmentById(R.id.details);
        if (details == null || details.getShownIndex() != index) {
            details = SubListsFragment.newInstance(index);

            FragmentTransaction ft = getFragmentManager().beginTransaction();
            ft.replace(R.id.details, details);
            ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            ft.commit();
        }

    } else {
        Intent intent = new Intent();
        intent.setClass(getActivity(), SubListsActivity.class);
        intent.putExtra(Constants.EXTRA_INDEX, index);
        startActivity(intent);
    }
}

From source file:com.gsma.rcs.ri.messaging.GroupTalkView.java

/**
 * Forge intent to notify Group Chat message
 *
 * @param ctx The context./*from ww  w .  j a v a  2s .c  o  m*/
 * @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, GroupTalkView.class);
    newgroupChatMessage.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    newgroupChatMessage.putExtra(GroupTalkView.EXTRA_MODE, GroupChatMode.INCOMING);
    newgroupChatMessage.putExtra(GroupChatIntent.EXTRA_CHAT_ID, chatId);
    return newgroupChatMessage;
}

From source file:com.idt.ontomedia.geoconsum.fragments.GeoconsumListFragment.java

@Override
public void onListItemClick(ListView _listView, View _view, int _position, long _id) {
    super.onListItemClick(_listView, _view, _position, _id);

    Cursor cursor = mCursorAdapter.getCursor();

    if ((cursor != null) && (!cursor.isClosed())) {
        cursor.moveToPosition(_position);
        Intent intent = new Intent();
        intent.setClass(mParentActivity, mDestinationActivityClass);
        intent.putExtra(EXTRA_ID_KEY, cursor.getInt(cursor.getColumnIndex(DatabaseAdapter.COLUMN_ROWID)));
        startActivity(intent);/* w  w w  .  j a v  a  2 s .  c  o m*/
    }
}

From source file:com.android.calendar.selectcalendars.SelectVisibleCalendarsActivity.java

public void handleSelectSyncedCalendarsClicked(View v) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setClass(this, SelectSyncedCalendarsMultiAccountActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    startActivity(intent);/*ww w. ja v a2  s  . com*/
}

From source file:com.miz.mizuu.TvShowDetails.java

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 0) {
        if (resultCode == Activity.RESULT_OK) {
            finish();/*from w ww. j  av  a  2  s .  c  o m*/
        }
    } else if (requestCode == 1) {
        if (resultCode == Activity.RESULT_OK) {
            Toast.makeText(this, getString(R.string.updatedTvShow), Toast.LENGTH_SHORT).show();

            // Create a new Intent with the Bundle
            Intent intent = new Intent();
            intent.setClass(getApplicationContext(), TvShowDetails.class);
            intent.putExtra("showId", mShowId);

            // Start the Intent for result
            startActivity(intent);

            finish();
        }
    }
}

From source file:com.miz.mizuu.MovieDetails.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == 4) {
        Toast.makeText(this, getString(R.string.updatedMovie), Toast.LENGTH_SHORT).show();

        // Create a new Intent with the Bundle
        Intent intent = new Intent();
        intent.setClass(getApplicationContext(), MovieDetails.class);
        intent.putExtra("tmdbId", mMovieId);

        // Start the Intent for result
        startActivity(intent);/*from  w  w  w  .ja  v  a 2s.co  m*/

        finish();
    }
}

From source file:com.android.viewflow.ImageAdapter.java

public void IntentNewsDetail(int position) {
    Intent intent = new Intent();
    intent.setClass(mContext, NewDetailActivity.class);
    intent.putExtra("image_id", images[position % images.length]);
    intent.putExtra("title", strName[position % strName.length]);
    intent.putExtra("type", "news");
    intent.putExtra("time", "2014-01-01");
    intent.putExtra("description", des);
    intent.putExtra("src", "");
    mContext.startActivity(intent);/*from   ww w  .ja  v a  2 s.co  m*/
}

From source file:com.android.viewflow.ImageAdapter.java

public void IntentVedioDetail(int position) {
    Intent intent = new Intent();
    intent.setClass(mContext, VedioDetailActivity.class);
    intent.putExtra("image_id", images[position % images.length]);
    intent.putExtra("title", strName[position % strName.length]);
    intent.putExtra("type", "vedio");
    intent.putExtra("actor", "?");
    intent.putExtra("description", des);
    intent.putExtra("director", "");
    intent.putExtra("years", "19");
    mContext.startActivity(intent);/*w  w w .  ja  v a  2 s .com*/
}

From source file:com.perm.DoomPlay.MainLocalFragment.java

void goAlbums() {
    Intent intent = new Intent(AlbumArtistActivity.actionPlayAlbum);
    intent.setClass(getActivity(), AlbumArtistActivity.class);
    startActivity(intent);//from w  ww .  ja v  a  2  s  .  c om
}