List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.andrew.apolloMod.activities.QueryBrowserActivity.java
@Override protected void onListItemClick(ListView l, View v, int position, long id) { // Dialog doesn't allow us to wait for a result, so we need to store // the info we need for when the dialog posts its result mQueryCursor.moveToPosition(position); if (mQueryCursor.isBeforeFirst() || mQueryCursor.isAfterLast()) { return;/*from w ww . j a v a 2 s.c om*/ } String selectedType = mQueryCursor.getString(mQueryCursor.getColumnIndexOrThrow(Audio.Media.MIME_TYPE)); if ("artist".equals(selectedType)) { Intent intent = new Intent(Intent.ACTION_VIEW); TextView tv1 = (TextView) v.findViewById(R.id.listview_item_line_one); String artistName = tv1.getText().toString(); Bundle bundle = new Bundle(); bundle.putString(MIME_TYPE, Audio.Artists.CONTENT_TYPE); bundle.putString(ARTIST_KEY, artistName); bundle.putLong(BaseColumns._ID, id); intent.setClass(this, TracksBrowser.class); intent.putExtras(bundle); startActivity(intent); finish(); } else if ("album".equals(selectedType)) { TextView tv1 = (TextView) v.findViewById(R.id.listview_item_line_one); TextView tv2 = (TextView) v.findViewById(R.id.listview_item_line_two); String artistName = tv2.getText().toString(); String albumName = tv1.getText().toString(); Bundle bundle = new Bundle(); bundle.putString(MIME_TYPE, Audio.Albums.CONTENT_TYPE); bundle.putString(ARTIST_KEY, artistName); bundle.putString(ALBUM_KEY, albumName); bundle.putLong(BaseColumns._ID, id); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClass(this, TracksBrowser.class); intent.putExtras(bundle); startActivity(intent); finish(); } else if (position >= 0 && id >= 0) { long[] list = new long[] { id }; MusicUtils.playAll(this, list, 0); } else { Log.e("QueryBrowser", "invalid position/id: " + position + "/" + id); } }
From source file:org.openremote.android.console.GroupActivity.java
/** * Handle the 7 sorts of navigate.//from www .ja va2 s. c o m * * @param navigate the navigate * * @return true, if successful */ private boolean navigateTo(Navigate navigate) { if (navigate.isNextScreen()) { return moveRight(); } else if (navigate.isPreviousScreen()) { return moveLeft(); } else if (navigate.getToGroup() > 0) { return navigateToGroup(navigate.getToGroup(), navigate.getToScreen()); } else if (navigate.isBack()) { if (navigationHistory.size() > 0) { Navigate backward = navigationHistory.get(navigationHistory.size() - 1); if (backward.getFromGroup() > 0 && backward.getFromScreen() > 0) { if (backward.getFromGroup() == getCurrentGroupId()) { isNavigetionBackward = getScreenIndex(backward.getFromScreen(), isLandscape) < getScreenIndex(currentScreen.getScreenId(), isLandscape); } navigateToGroup(backward.getFromGroup(), backward.getFromScreen()); } navigationHistory.remove(backward); } } else if (navigate.isSetting()) { Intent intent = new Intent(); intent.setClass(GroupActivity.this, AppSettingsActivity.class); startActivity(intent); } else if (navigate.isLogin()) { Intent intent = new Intent(); intent.setClass(GroupActivity.this, LoginViewActivity.class); startActivity(intent); } else if (navigate.isLogout()) { doLogout(); } return false; }
From source file:com.cssweb.android.base.DialogActivity.java
/** * ???/*from ww w .ja va2s.co m*/ * @param paramInt * @param paramInt2 */ private void gotoLogin(int paramInt, int paramInt2) { Intent localIntent = new Intent(); if (FairyUI.genIsActiveIntent(paramInt, paramInt2, DialogActivity.this)) { localIntent.putExtra("menu_id", paramInt); localIntent.putExtra("isChangeBtn", true); localIntent.setClass(DialogActivity.this, LoginActivity.class); startActivity(localIntent); } else { localIntent.putExtra("menu_id", activityKind); localIntent.setClass(DialogActivity.this, SMSJHActivity.class); startActivity(localIntent); } }
From source file:com.sft.blackcatapp.SearchCoachActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (data != null) { if (resultCode == R.id.base_left_btn) { return; }/*from w ww.j a va2 s. c o m*/ boolean isFromEnroll = data.getBooleanExtra(from_searchCoach_enroll, false); if (isFromEnroll) { data.setClass(this, ApplyActivity.class); data.putExtra(from_searchCoach_enroll, isFromEnroll); startActivity(data); finish(); } } }
From source file:com.android.packageinstaller.PackageInstallerActivity.java
private void startInstall() { // Start subactivity to actually install the application Intent newIntent = new Intent(); newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, mPkgInfo.applicationInfo); newIntent.setData(mPackageURI);/* w w w . jav a2 s .c om*/ newIntent.setClass(this, InstallAppProgress.class); String installerPackageName = getIntent().getStringExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME); if (mOriginatingURI != null) { newIntent.putExtra(Intent.EXTRA_ORIGINATING_URI, mOriginatingURI); } if (mReferrerURI != null) { newIntent.putExtra(Intent.EXTRA_REFERRER, mReferrerURI); } if (mOriginatingUid != VerificationParams.NO_UID) { newIntent.putExtra(Intent.EXTRA_ORIGINATING_UID, mOriginatingUid); } if (installerPackageName != null) { newIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, installerPackageName); } if (getIntent().getBooleanExtra(Intent.EXTRA_RETURN_RESULT, false)) { newIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true); newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); } if (localLOGV) Log.i(TAG, "downloaded app uri=" + mPackageURI); startActivity(newIntent); finish(); }
From source file:com.cssweb.android.base.DialogActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.zr_hq_mystock: if (!TradeUtil.checkUserLogin()) { FairyUI.switchToWnd(Global.QUOTE_USERSTK, Global.QUOTE_USERSTK, DialogActivity.this); } else {/*from w w w . j a va 2 s . c om*/ FairyUI.switchToWnd(Global.QUOTE_USERSTK, null, null, null, DialogActivity.this); } break; case R.id.zr_hq_addstock: if (cssStock == null) { msg_info = "??"; openDialog(msg_info); } else { if (!TradeUtil.checkUserLogin()) { FairyUI.switchToWnd(activityKind, activityKind, DialogActivity.this); } else { msg_info = StockPreference.shareStock(NameRule.getExchange(cssStock.getMarket()), cssStock.getStkcode(), cssStock.getStkname(), DialogActivity.this); openDialog(msg_info); } } break; case R.id.zr_hq_quickbuy: buyStock(); break; case R.id.zr_hq_quicksale: saleStock(); break; case R.id.zr_hq_revocation: cancelStock(); break; case R.id.zr_hq_gugle://??? if (null == cssStock) { toast("??"); return false; } Intent localIntent = new Intent(); localIntent.putExtra("pos", Global.NJZQ_ZXLP_GG); localIntent.putExtra("stockcode", cssStock.getStkcode()); localIntent.setClass(DialogActivity.this, WebViewDisplay.class); startActivity(localIntent); break; case R.id.zr_hq_fundtrade: if (TradeUser.getInstance().getLoginType() == 1 && TradeUtil.checkUserLogin()) { FairyUI.switchToWnd(Global.NJZQ_WTJY_TWO, 2, null, null, DialogActivity.this); } else { gotoLogin(Global.NJZQ_WTJY_TWO, Global.NJZQ_WTJY_TWO); } break; case R.id.zr_index: backIndex(); break; case R.id.zr_hq_mystock_set: initStockBar(); break; case R.id.zr_hq_remove: delMenuStock(); break; case R.id.zr_hq_queryfund: // queryFund(); break; case R.id.zr_hq_chicang://? if (TradeUser.getInstance().getLoginType() == 1 && TradeUtil.checkUserLogin()) { new AlertDialog.Builder(DialogActivity.this).setTitle(getResources().getString(R.string.alert_tip)) .setMessage(getResources().getString(R.string.importdata)) .setPositiveButton(getResources().getString(R.string.alert_dialog_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { addChiCang(); } }) .setNegativeButton(getResources().getString(R.string.alert_dialog_cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }) .show(); } else { gotoLogin(activityKind, activityKind); } break; case R.id.zr_hq_boom://? System.out.println("****" + "?"); if (null == cssStock) { toast("??"); return false; } Intent intent2StockRadar = new Intent(DialogActivity.this, StockRadar.class); Bundle StockRadarextras = new Bundle(); StockRadarextras.putString("stockcode", cssStock.getStkcode()); StockRadarextras.putString("stockname", cssStock.getStkname()); // StockRadarextras.putInt("exchange", cssStock.getExchange()); StockRadarextras.putString("exchange", cssStock.getMarket()); intent2StockRadar.putExtras(StockRadarextras); startActivity(intent2StockRadar); break; } return super.onOptionsItemSelected(item); }
From source file:com.mappn.gfan.ui.HomeTabActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(); switch (item.getItemId()) { case R.id.menu_account: Utils.trackEvent(getApplicationContext(), Constants.GROUP_8, Constants.MENU_CLICK_ACCOUNT); intent.setClass(getApplicationContext(), PersonalAccountActivity.class); startActivity(intent);//from w w w . jav a 2 s. com break; case R.id.menu_setting: Utils.trackEvent(getApplicationContext(), Constants.GROUP_8, Constants.MENU_CLICK_SETTINGS); intent.setClass(getApplicationContext(), ClientPreferenceActivity.class); startActivity(intent); break; case R.id.menu_feedback: Utils.trackEvent(getApplicationContext(), Constants.GROUP_8, Constants.MENU_CLICK_FEEDBACK); intent.setClass(getApplicationContext(), FeedBackActivity.class); startActivity(intent); break; case R.id.menu_bbs: Utils.trackEvent(getApplicationContext(), Constants.GROUP_8, Constants.MENU_CLICK_BBS); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse("http://bbs.gfan.com/mobile/")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); break; case R.id.menu_exit: if (!isFinishing()) { showDialog(DIALOG_EXIT); } break; default: break; } return super.onOptionsItemSelected(item); }
From source file:com.miz.mizuu.fragments.MovieLibraryFragment.java
private void viewMovieDetails(int position, View view) { Intent intent = new Intent(); if (mMovieLoader.getType() == MovieLibraryType.COLLECTIONS) { // Collection intent.putExtra("collectionId", mAdapter.getItem(position).getCollectionId()); intent.putExtra("collectionTitle", mAdapter.getItem(position).getCollection()); intent.setClass(mContext, MovieCollection.class); startActivity(intent);/* ww w.j a va 2s. co m*/ } else { intent.putExtra("tmdbId", mAdapter.getItem(position).getTmdbId()); intent.setClass(mContext, MovieDetails.class); if (view != null) { Pair<View, String> pair = new Pair<>(view.findViewById(R.id.cover), "cover"); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), pair); ActivityCompat.startActivityForResult(getActivity(), intent, 0, options.toBundle()); } else { startActivityForResult(intent, 0); } } }
From source file:com.ibm.mf.geofence.MFGeofencingManager.java
/** * Get a pending intent for the specified callback. * @param geofenceCallbackUuid the uuid of an internally mapped callback. * @return a <code>PendingIntent</code> instance. *//* ww w . jav a 2 s . co m*/ private PendingIntent getPendingIntent(String geofenceCallbackUuid) { if (mPendingIntent == null) { Intent intent = new Intent(mContext, GeofenceTransitionsService.class); //intent.setPackage(context.getPackageName()); ServiceConfig config = new ServiceConfig().fromGeofencingManager(this); config.populateFromSettings(mSettings); config.toIntent(intent); intent.putExtra(INTENT_ID, geofenceCallbackUuid); intent.setClass(mContext, GeofenceTransitionsService.class); mPendingIntent = PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } return mPendingIntent; }
From source file:com.jefftharris.passwdsafe.sync.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_about: { showAbout();/*from w ww . j a v a2 s . com*/ return true; } case R.id.menu_logs: { Intent intent = new Intent(); intent.setClass(this, SyncLogsActivity.class); startActivity(intent); return true; } case R.id.menu_add_box: { onBoxChoose(); return true; } case R.id.menu_add_dropbox: { onDropboxChoose(); return true; } case R.id.menu_add_google_drive: { onGdriveChoose(); return true; } case R.id.menu_add_onedrive: { onOnedriveChoose(); return true; } case R.id.menu_add_owncloud: { onOwncloudChoose(); return true; } default: { return super.onOptionsItemSelected(item); } } }