List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.BibleQuote.BibleQuoteAndroid.ui.ReaderActivity.java
public void onChooseChapterClick() { Intent intent = new Intent(); intent.setClass(this, LibraryActivity.class); startActivityForResult(intent, ID_CHOOSE_CH); }
From source file:com.orange.oidc.secproxy_service.Service.java
void resetCookies() { // init intent Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClass(Service.this, WebViewActivity.class); intent.putExtra("resetcookies", "true"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION); // launch webview startActivity(intent);//from www.j a v a2 s. co m }
From source file:com.android.music.AlbumBrowserFragment.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub Intent intent = new Intent(Intent.ACTION_PICK); intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track"); intent.setClass(getActivity(), TrackBrowserActivity.class); intent.putExtra("album", Long.valueOf(id).toString()); intent.putExtra("artist", mArtistId); startActivity(intent);/* ww w . j av a 2s .c o m*/ }
From source file:com.android.music.AlbumBrowserActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { badSymptoms.saveMenu("popup", item.toString()); switch (item.getItemId()) { case PLAY_SELECTION: { // play the selected album long[] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId)); MusicUtils.playAll(this, list, 0); return true; }//from w w w . ja va 2s.c o m case QUEUE: { long[] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId)); MusicUtils.addToCurrentPlaylist(this, list); return true; } case NEW_PLAYLIST: { Intent intent = new Intent(); intent.setClass(this, CreatePlaylist.class); startActivityForResult(intent, NEW_PLAYLIST); return true; } case PLAYLIST_SELECTED: { long[] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId)); long playlist = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(this, list, playlist); return true; } case DELETE_ITEM: { long[] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId)); String f; if (android.os.Environment.isExternalStorageRemovable()) { f = getString(R.string.delete_album_desc); } else { f = getString(R.string.delete_album_desc_nosdcard); } String desc = String.format(f, mCurrentAlbumName); Bundle b = new Bundle(); b.putString("description", desc); b.putLongArray("items", list); Intent intent = new Intent(); intent.setClass(this, DeleteItems.class); intent.putExtras(b); startActivityForResult(intent, -1); return true; } case SEARCH: doSearch(); return true; } return super.onContextItemSelected(item); }
From source file:com.google.sample.cast.refplayer.chatting.MainActivity.java
public void backVideoBrowser() { Intent intent = new Intent(); intent.setClass(MainActivity.this, VideoBrowserActivity.class); startActivity(intent);//w w w .j av a 2 s . co m }
From source file:com.lugia.timetable.ReminderService.java
@Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); Log.d("ReminderService", "Handle intent : " + action); Bundle extra = intent.getExtras();/* w w w. ja va 2 s . c o m*/ String subjectCode = extra.getString(EXTRA_SUBJECT_CODE); String header = extra.getString(EXTRA_HEADER); String content = extra.getString(EXTRA_CONTENT); String boardcastIntent = null; Intent notificationIntent = new Intent(); Uri soundUri = null; int notificationId; boolean vibrate; if (action.equals(ACTION_SCHEDULE_REMINDER)) { notificationId = SCHEDULE_NOTIFICATION_ID; vibrate = SettingActivity.getBoolean(ReminderService.this, SettingActivity.KEY_SCHEDULE_NOTIFY_VIBRATE, false); String soundUriStr = SettingActivity.getString(ReminderService.this, SettingActivity.KEY_SCHEDULE_NOTIFY_SOUND, ""); notificationIntent.setClass(ReminderService.this, SubjectDetailActivity.class) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra(SubjectDetailActivity.EXTRA_SUBJECT_CODE, subjectCode); soundUri = !TextUtils.isEmpty(soundUriStr) ? Uri.parse(soundUriStr) : null; boardcastIntent = ReminderReceiver.ACTION_UPDATE_SCHEDULE_REMINDER; } else if (action.equals(ACTION_EVENT_REMINDER)) { long eventId = intent.getLongExtra(EXTRA_EVENT_ID, -1); notificationId = EVENT_NOTIFICATION_ID; vibrate = SettingActivity.getBoolean(ReminderService.this, SettingActivity.KEY_EVENT_NOTIFY_VIBRATE, false); String soundUriStr = SettingActivity.getString(ReminderService.this, SettingActivity.KEY_EVENT_NOTIFY_SOUND, ""); notificationIntent.setClass(ReminderService.this, SubjectDetailActivity.class) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK).setAction(SubjectDetailActivity.ACTION_VIEW_EVENT) .putExtra(SubjectDetailActivity.EXTRA_EVENT_ID, eventId) .putExtra(SubjectDetailActivity.EXTRA_SUBJECT_CODE, subjectCode); soundUri = !TextUtils.isEmpty(soundUriStr) ? Uri.parse(soundUriStr) : null; boardcastIntent = ReminderReceiver.ACTION_UPDATE_EVENT_REMINDER; } else { Log.e(TAG, "Unknow action!"); return; } PendingIntent pendingIntent = PendingIntent.getActivity(ReminderService.this, 0, notificationIntent, 0); Notification notification = new NotificationCompat.Builder(ReminderService.this) .setSmallIcon(R.drawable.ic_notification_reminder).setTicker(header).setContentTitle(header) .setContentText(content).setContentIntent(pendingIntent).setAutoCancel(true) .setWhen(System.currentTimeMillis()).build(); // always show the notification light notification.defaults |= Notification.DEFAULT_LIGHTS; notification.flags |= Notification.FLAG_SHOW_LIGHTS; // only vibrate when user enable it if (vibrate) notification.defaults |= Notification.DEFAULT_VIBRATE; // set the notification sound notification.sound = soundUri; NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); manager.notify(notificationId, notification); // update the reminder, so it will notify user again on next schedule Intent broadcastIntent = new Intent(ReminderService.this, ReminderReceiver.class); broadcastIntent.setAction(boardcastIntent); sendBroadcast(broadcastIntent); }
From source file:jp.co.conit.sss.sn.ex2.fragment.MessagesFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(R.string.no_messages)); // EmptyText????INTERNAL_EMPTY_ID??TextView????? // INTERNAL_EMPTY_ID?ListFragment??EmptyText?ID?????????????ListFragment??????? TextView tx = (TextView) getView().findViewById(INTERNAL_EMPTY_ID); int color = getResources().getColor(R.color.settings_text_color); tx.setTextColor(color);//from www. j ava 2 s.c o m getListView().setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PushMessage pm = (PushMessage) parent.getItemAtPosition(position); String userData = pm.getUserData(); Intent activityIntent = new Intent(); if (StringUtil.isEmpty(userData) || userData.equals("null")) { return; } else { if (userData.startsWith("http")) { activityIntent.setAction(Intent.ACTION_VIEW); activityIntent.setData(Uri.parse(userData)); } else { activityIntent.setClass(mParentActivity, UserDataActivity.class); activityIntent.putExtra("option", userData); } } startActivity(activityIntent); } }); obtainMessagesAsync(); }
From source file:com.kayzook.bracediary.BaseActivity.java
private void selectItem(int position) { //update the main content by replacing fragments FragmentManager fragmentManager = getSupportFragmentManager(); Fragment fragment = null;//from w w w . j a v a 2s . c om Intent intent = new Intent(); switch (position) { case 0: fragment = new FindClinicsFragment(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); break; case 1: intent.setClass(this, RewardListActivityFragment.class); startActivity(intent); break; case 2: intent.setClass(this, PointHistoryActivityFragment.class); startActivity(intent); break; case 3: intent.setClass(this, ClinicActivityFragment.class); startActivity(intent); break; case 4: fragment = new HelpPageFragment(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); break; // case 5: // fragment = new HelpPageFragment(); // fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // break; default: fragment = new TimelineFragment(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); break; } // // // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); HashMap<String, Object> map = getHashMapForNaviMenu(position); setTitle(String.valueOf(map.get(KEY_NAV_ACTION))); mDrawerLayout.closeDrawer(mDrawer); }
From source file:com.uzmap.pkg.uzmodules.UIMediaScanner.UIMediaScanner.java
@UzJavascriptMethod @SuppressWarnings("deprecation") public void jsmethod_open(UZModuleContext moduleContext) { mMContext = moduleContext;//from w w w . j a v a2 s . c o m final ConfigInfo config = new ConfigInfo(); if (!moduleContext.isNull("column")) { config.col = moduleContext.optInt("column"); if (config.col == 0) { config.col = 4; } } if (!moduleContext.isNull("max")) { config.selectedMax = moduleContext.optInt("max"); } if (!moduleContext.isNull("classify")) { config.classify = moduleContext.optBoolean("classify"); } if (!moduleContext.isNull("type")) { config.filterType = moduleContext.optString("type"); } if (!moduleContext.isNull("rotation")) { config.rotation = moduleContext.optBoolean("rotation"); } /** * screen width */ WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); int width = wm.getDefaultDisplay().getWidth(); config.mark_size = UZCoreUtil.pixToDip(width / config.col / 3); if (!moduleContext.isNull("bounces")) { config.isBounces = moduleContext.optBoolean("bounces"); } JSONObject scrollToBottomObj = moduleContext.optJSONObject("scrollToBottom"); if (scrollToBottomObj != null && !scrollToBottomObj.isNull("intervalTime")) { config.intervalTime = scrollToBottomObj.optInt("intervalTime"); } if (!moduleContext.isNull("exchange")) { config.exchange = moduleContext.optBoolean("exchange"); } JSONObject sortObj = moduleContext.optJSONObject("sort"); if (sortObj != null) { if (!sortObj.isNull("key")) { config.key = sortObj.optString("key"); } if (!sortObj.isNull("order")) { config.order = sortObj.optString("order"); } } JSONObject dataObj = moduleContext.optJSONObject("texts"); if (dataObj != null) { if (!dataObj.isNull("stateText")) { config.navi_title = dataObj.optString("stateText"); } if (!dataObj.isNull("cancelText")) { config.cancel_title = dataObj.optString("cancelText"); } if (!dataObj.isNull("finishText")) { config.finish_title = dataObj.optString("finishText"); } } JSONObject stylesObj = moduleContext.optJSONObject("styles"); if (stylesObj != null) { // bg if (!stylesObj.isNull("bg")) { config.bgColor = UZUtility.parseCssColor(stylesObj.optString("bg")); } // mark JSONObject markObj = stylesObj.optJSONObject("mark"); if (markObj != null) { if (!markObj.isNull("position")) { config.mark_position = markObj.optString("position"); } if (!markObj.isNull("icon")) { config.mark_icon = makeRealPath(markObj.optString("icon")); } if (!markObj.isNull("size")) { config.mark_size = markObj.optInt("size"); } } // nav JSONObject navObj = stylesObj.optJSONObject("nav"); if (navObj != null) { if (!navObj.isNull("bg")) { Bitmap naviBgBitmap = getBitmap(makeRealPath(navObj.optString("bg"))); if (naviBgBitmap != null) { ConfigInfo.navBgBitmap = naviBgBitmap; } else { config.navi_bg = UZUtility.parseCssColor(navObj.optString("bg")); } } if (!navObj.isNull("stateColor")) { config.navi_title_color = UZUtility.parseCssColor(navObj.optString("stateColor")); } if (!navObj.isNull("stateSize")) { config.navi_title_size = navObj.optInt("stateSize"); } if (!navObj.isNull("cancleBg")) { Bitmap cancelBgBitmap = getBitmap(makeRealPath(navObj.optString("cancleBg"))); if (cancelBgBitmap != null) { ConfigInfo.cancelBgBitmap = getBitmap(makeRealPath(navObj.optString("cancleBg"))); } else { config.cancel_bg = UZUtility.parseCssColor(navObj.optString("cancleBg")); } } if (!navObj.isNull("cancelColor")) { config.cancel_title_color = UZUtility.parseCssColor(navObj.optString("cancelColor")); } if (!navObj.isNull("cancelSize")) { config.cancel_title_size = navObj.optInt("cancelSize"); } // finish button setting if (!navObj.isNull("finishBg")) { Bitmap finishBgBitmap = getBitmap(makeRealPath(navObj.optString("finishBg"))); if (finishBgBitmap != null) { ConfigInfo.finishBgBitmap = finishBgBitmap; } else { config.finish_bg = UZUtility.parseCssColor(navObj.optString("finishBg")); } } if (!navObj.isNull("finishColor")) { config.finish_title_color = UZUtility.parseCssColor(navObj.optString("finishColor")); } if (!navObj.isNull("finishSize")) { config.finish_title_size = navObj.optInt("finishSize"); } } } Intent intent = new Intent(); if (config.classify) { intent.setClass(getContext(), UzImgFileListActivity.class); } else { intent.setClass(getContext(), UzImgsActivity.class); } intent.putExtra(CONFIG_TAG, config); startActivityForResult(intent, REQUEST_CODE); }
From source file:com.cettco.buycar.activity.BargainActivity.java
private void submit() { String cookieStr = null;/* w ww. j av a 2 s . c om*/ String cookieName = null; PersistentCookieStore myCookieStore = new PersistentCookieStore(BargainActivity.this); if (myCookieStore == null) { return; } List<Cookie> cookies = myCookieStore.getCookies(); for (Cookie cookie : cookies) { String name = cookie.getName(); cookieName = name; //System.out.println(name); if (name.equals("_JustBidIt_session")) { cookieStr = cookie.getValue(); //System.out.println("value:" + cookieStr); break; } } if (cookieStr == null || cookieStr.equals("")) { Toast toast = Toast.makeText(BargainActivity.this, "", Toast.LENGTH_SHORT); toast.show(); Intent intent = new Intent(); intent.setClass(BargainActivity.this, SignInActivity.class); startActivity(intent); return; } String tenderUrl = GlobalData.getBaseUrl() + "/tenders.json?"; // String price = priceEditText.getText().toString(); // String userName = userNameEditText.getText().toString(); String price = orderItemEntity.getPrice(); String userName = orderItemEntity.getName(); if (price == null || price.equals("")) { Toast toast = Toast.makeText(BargainActivity.this, "", Toast.LENGTH_SHORT); toast.show(); return; } if (colors == null || colors.size() == 0) { Toast toast = Toast.makeText(BargainActivity.this, "?", Toast.LENGTH_SHORT); toast.show(); return; } if (dealers == null || dealers.size() == 0) { Toast toast = Toast.makeText(BargainActivity.this, "4s", Toast.LENGTH_SHORT); toast.show(); return; } if (userName == null || userName.equals("")) { Toast toast = Toast.makeText(BargainActivity.this, "??", Toast.LENGTH_SHORT); toast.show(); return; } Tender tender = new Tender(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < colors.size(); i++) { buffer.append(colors.get(i) + ","); } if (buffer != null && buffer.length() > 0) { buffer.deleteCharAt(buffer.length() - 1); } tender.setColors_id(buffer.toString()); tender.setGot_licence(String.valueOf(plateSelection)); tender.setLoan_option(String.valueOf(loanSelection + 1)); tender.setTrim_id(trim_id); tender.setPickup_time(String.valueOf(getcarTimeSelection)); tender.setUser_name(userName); String locationString = locationList.get(locationSelection); tender.setLicense_location(locationString); tender.setPrice(price); String description = descriptionEditText.getText().toString(); // tender.setde tender.setDescription(description); Map<String, String> shops = new HashMap<String, String>(); for (int i = 0; i < dealers.size(); i++) { shops.put(dealers.get(i), "1"); } tender.setShops(shops); TenderEntity tenderEntity = new TenderEntity(); tenderEntity.setTender(tender); Gson gson = new Gson(); //System.out.println(gson.toJson(tenderEntity).toString()); StringEntity entity = null; try { // System.out.println(gson.toJson(bargainEntity).toString()); entity = new StringEntity(gson.toJson(tenderEntity).toString(), "utf-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } progressLayout.setVisibility(View.VISIBLE); HttpConnection.getClient().addHeader("Cookie", cookieName + "=" + cookieStr); HttpConnection.post(BargainActivity.this, tenderUrl, null, entity, "application/json;charset=utf-8", new JsonHttpResponseHandler() { @Override public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { // TODO Auto-generated method stub super.onFailure(statusCode, headers, throwable, errorResponse); progressLayout.setVisibility(View.GONE); //System.out.println("error"); //System.out.println("statusCode:" + statusCode); //System.out.println("headers:" + headers); if (statusCode == 401) { Message msg = new Message(); msg.what = RESULT_UNAUTHORIZED; handler.sendMessage(msg); } else if (statusCode == 422) { Message msg = new Message(); msg.what = RESULT_UNPROCESSABLE; handler.sendMessage(msg); } else { Toast toast = Toast.makeText(BargainActivity.this, "??,???", Toast.LENGTH_SHORT); toast.show(); } } @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { // TODO Auto-generated method stub super.onSuccess(statusCode, headers, response); progressLayout.setVisibility(View.GONE); //System.out.println("success"); //System.out.println("statusCode:" + statusCode); // for(int i=0;i<headers.length;i++){ // System.out.println(headers[0]); // } //System.out.println("response:" + response); String tender_id = ""; if (statusCode == 201) { try { //System.out.println("id:" //+ response.getString("id")); tender_id = response.getString("id"); orderItemEntity.setId(response.getString("id")); orderItemEntity.setState(response.getString("state")); DatabaseHelperOrder orderHelper = DatabaseHelperOrder .getHelper(BargainActivity.this); orderHelper.getDao().update(orderItemEntity); } catch (JSONException | SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } Toast toast = Toast.makeText(BargainActivity.this, "???", Toast.LENGTH_SHORT); toast.show(); Intent intent = new Intent(); // intent.putExtra("tenderId", id); intent.setClass(BargainActivity.this, AliPayActivity.class); intent.putExtra("tender_id", tender_id); startActivity(intent); // Intent intent = new Intent(); // // intent.putExtra("tenderId", id); // intent.setClass(BargainActivity.this, // MainActivity.class); // intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // startActivity(intent); } } }); }