List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:terse.a1.TerseActivity.java
private void viewPath9display(String path, LayoutParams widgetParams) { String explain;/*from w w w . j a v a 2 s.c o m*/ if (terp_error != null) { explain = "terp_error = " + terp_error; } else { try { terp.say("Sending to terp: %s", path); final Dict d = terp.handleUrl(path, taQuery); explain = "DEFAULT EXPLANATION:\n\n" + d.toString(); Str TYPE = d.cls.terp.newStr("type"); Str VALUE = d.cls.terp.newStr("value"); Str TITLE = d.cls.terp.newStr("title"); Str type = (Str) d.dict.get(TYPE); Ur value = d.dict.get(VALUE); Ur title = d.dict.get(TITLE); // { // double ticks = Static.floatAt(d, "ticks", -1); // double nanos = Static.floatAt(d, "nanos", -1); // Toast.makeText( // getApplicationContext(), // Static.fmt("%d ticks, %.3f secs", (long) ticks, // (double) nanos / 1e9), Toast.LENGTH_SHORT) // .show(); // } if (type.str.equals("list") && value instanceof Vec) { final ArrayList<Ur> v = ((Vec) value).vec; final ArrayList<String> labels = new ArrayList<String>(); final ArrayList<String> links = new ArrayList<String>(); for (int i = 0; i < v.size(); i++) { Ur item = v.get(i); String label = item instanceof Str ? ((Str) item).str : item.toString(); if (item instanceof Vec && ((Vec) item).vec.size() == 2) { // OLD STYLE label = ((Vec) item).vec.get(0).toString(); Matcher m = LINK_P.matcher(label); if (m.lookingAt()) { label = m.group(2) + " " + m.group(3); } label += " [" + ((Vec) item).vec.get(1).toString().length() + "]"; links.add(null); // Use old style, not links. } else { // NEW STYLE label = item.toString(); if (label.charAt(0) == '/') { String link = Terp.WHITE_PLUS.split(label, 2)[0]; links.add(link); } else { links.add(""); } } labels.add(label); } if (labels.size() != links.size()) terp.toss("lables#%d links#%d", labels.size(), links.size()); ListView listv = new ListView(this); listv.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item, labels)); listv.setLayoutParams(widgetParams); listv.setTextFilterEnabled(true); listv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // When clicked, show a toast with the TextView text // Toast.makeText(getApplicationContext(), // ((TextView) view).getText(), // Toast.LENGTH_SHORT).show(); String toast_text = ((TextView) view).getText().toString(); // if (v.get(position) instanceof Vec) { if (links.get(position) == null) { // OLD STYLE Vec pair = (Vec) v.get(position); if (pair.vec.size() == 2) { if (pair.vec.get(0) instanceof Str) { String[] words = ((Str) pair.vec.get(0)).str.split("\\|"); Log.i("TT-WORDS", terp.arrayToString(words)); toast_text += "\n\n" + Static.arrayToString(words); if (words[1].equals("link")) { Uri uri = new Uri.Builder().scheme("terse").path(words[2]).build(); Intent intent = new Intent("android.intent.action.MAIN", uri); intent.setClass(getApplicationContext(), TerseActivity.class); startActivity(intent); } } } } else { // NEW STYLE terp.say("NEW STYLE LIST SELECT #%d link=<%s> label=<%s>", position, links.get(position), labels.get(position)); if (links.get(position).length() > 0) { Uri uri = new Uri.Builder().scheme("terse").path(links.get(position)).build(); Intent intent = new Intent("android.intent.action.MAIN", uri); intent.setClass(getApplicationContext(), TerseActivity.class); startActivity(intent); } } // } // Toast.makeText(getApplicationContext(), // ((TextView) view).getText(), // Toast.LENGTH_SHORT).show(); } }); setContentView(listv); return; } else if (type.str.equals("edit") && value instanceof Str) { final EditText ed = new EditText(this); ed.setText(taSaveMe == null ? value.toString() : taSaveMe); ed.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); ed.setLayoutParams(widgetParams); // ed.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); ed.setTextAppearance(this, R.style.teletype); ed.setBackgroundColor(Color.BLACK); ed.setGravity(Gravity.TOP); ed.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET); ed.setVerticalFadingEdgeEnabled(true); ed.setVerticalScrollBarEnabled(true); ed.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" // button // if ((event.getAction() == KeyEvent.ACTION_DOWN) // && // (keyCode == KeyEvent.KEYCODE_ENTER)) { // // Perform action on key press // Toast.makeText(TerseActivity.this, ed.getText(), // Toast.LENGTH_SHORT).show(); // return true; // } return false; } }); Button btn = new Button(this); btn.setText("Save"); btn.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on clicks String text = ed.getText().toString(); text = Parser.charSubsts(text); Toast.makeText(TerseActivity.this, text, Toast.LENGTH_SHORT).show(); String action = stringAt(d, "action"); String query = ""; String f1 = stringAt(d, "field1"); String v1 = stringAt(d, "value1"); String f2 = stringAt(d, "field2"); String v2 = stringAt(d, "value2"); f1 = (f1 == null) ? "f1null" : f1; v1 = (v1 == null) ? "v1null" : v1; f2 = (f2 == null) ? "f2null" : f2; v2 = (v2 == null) ? "v2null" : v2; startTerseActivity(action, query, stringAt(d, "field1"), stringAt(d, "value1"), stringAt(d, "field2"), stringAt(d, "value2"), "text", text); } }); LinearLayout linear = new LinearLayout(this); linear.setOrientation(LinearLayout.VERTICAL); linear.addView(btn); linear.addView(ed); setContentView(linear); return; } else if (type.str.equals("draw") && value instanceof Vec) { Vec v = ((Vec) value); DrawView dv = new DrawView(this, v.vec, d); dv.setLayoutParams(widgetParams); setContentView(dv); return; } else if (type.str.equals("live")) { Blk blk = value.mustBlk(); Blk event = Static.urAt(d, "event").asBlk(); TerseSurfView tsv = new TerseSurfView(this, blk, event); setContentView(tsv); return; } else if (type.str.equals("fnord")) { Blk blk = value.mustBlk(); Blk event = Static.urAt(d, "event").asBlk(); FnordView fnord = new FnordView(this, blk, event); setContentView(fnord); return; } else if (type.str.equals("world") && value instanceof Str) { String newWorld = value.toString(); if (Terp.WORLD_P.matcher(newWorld).matches()) { world = newWorld; resetTerp(); explain = Static.fmt("Switching to world <%s>\nUse menu to go Home.", world); Toast.makeText(getApplicationContext(), explain, Toast.LENGTH_LONG).show(); } else { terp.toss("Bad world syntax (must be 3 letters then 0 to 3 digits: <%s>", newWorld); } // Fall thru for explainv.setText(explain). } else if (type.str.equals("text")) { explain = "<<< " + title + " >>>\n\n" + value.toString(); // Fall thru for explainv.setText(explain). } else if (type.str.equals("html")) { final WebView webview = new WebView(this); // webview.loadData(value.toString(), "text/html", null); webview.loadDataWithBaseURL("terse://terse", value.toString(), "text/html", "UTF-8", null); webview.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // terp.say("WebView UrlLoading: url=%s", url); URI uri = URI.create("" + url); // terp.say("WebView UrlLoading: URI=%s", uri); terp.say("WebView UrlLoading: getPath=%s", uri.getPath()); terp.say("WebView UrlLoading: getQuery=%s", uri.getQuery()); // Toast.makeText(getApplicationContext(), // uri.toASCIIString(), Toast.LENGTH_SHORT) // .show(); // webview.invalidate(); // // TextView quick = new // TextView(TerseActivity.this); // quick.setText(uri.toASCIIString()); // quick.setBackgroundColor(Color.BLACK); // quick.setTextColor(Color.WHITE); // setContentView(quick); startTerseActivity(uri.getPath(), uri.getQuery()); return true; } }); // webview.setWebChromeClient(new WebChromeClient()); webview.getSettings().setBuiltInZoomControls(true); // webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setDefaultFontSize(18); webview.getSettings().setNeedInitialFocus(true); webview.getSettings().setSupportZoom(true); webview.getSettings().setSaveFormData(true); setContentView(webview); // ScrollView scrollv = new ScrollView(this); // scrollv.addView(webview); // setContentView(scrollv); return; } else { explain = "Unknown page type: " + type.str + " with vaule type: " + value.cls + "\n\n##############\n\n"; explain += value.toString(); // Fall thru for explainv.setText(explain). } } catch (Exception ex) { ex.printStackTrace(); explain = Static.describe(ex); } } TextView explainv = new TextView(this); explainv.setText(explain); explainv.setBackgroundColor(Color.BLACK); explainv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24); explainv.setTextColor(Color.YELLOW); SetContentViewWithHomeButtonAndScroll(explainv); }
From source file:com.sft.fragment.SchoolsFragment.java
@Override public void onActivityResult(int requestCode, final int resultCode, final Intent data) { if (data != null) { if (resultCode == R.id.base_left_btn) { SchoolVO school = (SchoolVO) data.getSerializableExtra("school"); if (app.userVO != null && app.userVO.getApplystate().equals(EnrollResult.SUBJECT_NONE.getValue()) && school != null) { int position = adapter.getData().indexOf(school); adapter.setSelected(position); adapter.notifyDataSetChanged(); }// ww w .j a v a 2 s .co m return; } LogUtil.print("schoolsss-->"); if (isFromMenu) { data.setClass(getActivity(), ApplyActivity.class); data.putExtra("isFromMenu", isFromMenu); startActivity(data); } new MyHandler(200) { @Override public void run() { getActivity().setResult(resultCode, data); getActivity().finish(); } }; } }
From source file:com.ringdroid.RingdroidEditActivity.java
@Override protected Dialog onCreateDialog(int id) { if (id == DIALOG_USE_ALL) { return new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert) .setTitle(R.string.ring_picker_title) .setSingleChoiceItems(R.array.set_ring_option, 0, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { ring_button_type = whichButton; }/*from w w w . j av a 2 s . co m*/ }).setPositiveButton(R.string.alert_ok_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { int ring_type = 0; if (ring_button_type == 3) { Intent intent = new Intent(); Uri currentFileUri = Uri.parse(mFilename); intent.setData(currentFileUri); intent.setClass(RingdroidEditActivity.this, com.ringdroid.ChooseContactActivity.class); RingdroidEditActivity.this.startActivity(intent); return; } else if (ring_button_type == 0) { ring_type = RingtoneManager.TYPE_RINGTONE; } else if (ring_button_type == 1) { ring_type = RingtoneManager.TYPE_NOTIFICATION; } else if (ring_button_type == 2) { ring_type = RingtoneManager.TYPE_ALARM; } // u = Const.mp3dir + ring.getString(Const.mp3); Uri currentFileUri = null; if (!mFilename.startsWith("content:")) { String selection; selection = MediaStore.Audio.Media.DATA + "=?";//+"='"+DatabaseUtils.sqlEscapeString(mFilename)+"'"; String[] selectionArgs = new String[1]; selectionArgs[0] = mFilename; Uri head = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Cursor c = getExternalAudioCursor(selection, selectionArgs); if (c == null || c.getCount() == 0) { head = MediaStore.Audio.Media.INTERNAL_CONTENT_URI; c = getInternalAudioCursor(selection, selectionArgs); } startManagingCursor(c); if (c == null || c.getCount() == 0) return; c.moveToFirst(); String itemUri = head.toString() + "/" + c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media._ID)); currentFileUri = Uri.parse(itemUri); } else { currentFileUri = Uri.parse(mFilename); } RingtoneManager.setActualDefaultRingtoneUri(RingdroidEditActivity.this, ring_type, currentFileUri); Toast.makeText(RingdroidEditActivity.this, "" + getResources().getStringArray(R.array.set_ring_option)[ring_button_type], Toast.LENGTH_SHORT).show(); } }).setNegativeButton(R.string.alertdialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).create(); } return super.onCreateDialog(id); }
From source file:co.taqat.call.LinphoneActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { //This must be done before calling super.onCreate(). super.onCreate(savedInstanceState); if (getResources().getBoolean(R.bool.orientation_portrait_only)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }//from w w w . j ava 2 s.c om boolean useFirstLoginActivity = getResources().getBoolean(R.bool.display_account_assistant_at_first_start); if (LinphonePreferences.instance().isProvisioningLoginViewEnabled()) { Intent wizard = new Intent(); wizard.setClass(this, RemoteProvisioningLoginActivity.class); wizard.putExtra("Domain", LinphoneManager.getInstance().wizardLoginViewDomain); startActivity(wizard); finish(); return; } else if (savedInstanceState == null && (useFirstLoginActivity && LinphonePreferences.instance().isFirstLaunch())) { if (LinphonePreferences.instance().getAccountCount() > 0) { LinphonePreferences.instance().firstLaunchSuccessful(); } else { startActivity(new Intent().setClass(this, AssistantActivity.class)); finish(); return; } } if (getIntent() != null && getIntent().getExtras() != null) { newProxyConfig = getIntent().getExtras().getBoolean("isNewProxyConfig"); } if (getResources().getBoolean(R.bool.use_linphone_tag)) { if (getPackageManager().checkPermission(Manifest.permission.WRITE_SYNC_SETTINGS, getPackageName()) != PackageManager.PERMISSION_GRANTED) { checkSyncPermission(); } else { ContactsManager.getInstance().initializeSyncAccount(getApplicationContext(), getContentResolver()); } } else { ContactsManager.getInstance().initializeContactManager(getApplicationContext(), getContentResolver()); } setContentView(R.layout.main); instance = this; fragmentsHistory = new ArrayList<FragmentsAvailable>(); pendingFragmentTransaction = FragmentsAvailable.UNKNOW; initButtons(); initSideMenu(); currentFragment = FragmentsAvailable.EMPTY; if (savedInstanceState == null) { changeCurrentFragment(FragmentsAvailable.DIALER, getIntent().getExtras()); } else { currentFragment = (FragmentsAvailable) savedInstanceState.getSerializable("currentFragment"); } mListener = new LinphoneCoreListenerBase() { @Override public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { displayMissedChats(getUnreadMessageCount()); } @Override public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) { if (state.equals(RegistrationState.RegistrationCleared)) { if (lc != null) { LinphoneAuthInfo authInfo = lc.findAuthInfo(proxy.getIdentity(), proxy.getRealm(), proxy.getDomain()); if (authInfo != null) lc.removeAuthInfo(authInfo); } } refreshAccounts(); if (getResources().getBoolean(R.bool.use_phone_number_validation)) { if (state.equals(RegistrationState.RegistrationOk)) { LinphoneManager.getInstance().isAccountWithAlias(); } } if (state.equals(RegistrationState.RegistrationFailed) && newProxyConfig) { newProxyConfig = false; if (proxy.getError() == Reason.BadCredentials) { //displayCustomToast(getString(R.string.error_bad_credentials), Toast.LENGTH_LONG); } if (proxy.getError() == Reason.Unauthorized) { displayCustomToast(getString(R.string.error_unauthorized), Toast.LENGTH_LONG); } if (proxy.getError() == Reason.IOError) { displayCustomToast(getString(R.string.error_io_error), Toast.LENGTH_LONG); } } } @Override public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { if (state == State.IncomingReceived) { startActivity(new Intent(LinphoneActivity.instance(), CallIncomingActivity.class)); } else if (state == State.OutgoingInit || state == State.OutgoingProgress) { startActivity(new Intent(LinphoneActivity.instance(), CallOutgoingActivity.class)); } else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) { resetClassicMenuLayoutAndGoBackToCallIfStillRunning(); } int missedCalls = LinphoneManager.getLc().getMissedCallsCount(); displayMissedCalls(missedCalls); } }; int missedCalls = LinphoneManager.getLc().getMissedCallsCount(); displayMissedCalls(missedCalls); int rotation = getWindowManager().getDefaultDisplay().getRotation(); switch (rotation) { case Surface.ROTATION_0: rotation = 0; break; case Surface.ROTATION_90: rotation = 90; break; case Surface.ROTATION_180: rotation = 180; break; case Surface.ROTATION_270: rotation = 270; break; } LinphoneManager.getLc().setDeviceRotation(rotation); mAlwaysChangingPhoneAngle = rotation; }
From source file:com.adafruit.bluefruit.le.connect.app.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_help) { startHelp();/*from w w w .ja va2 s .co m*/ return true; } else if (id == R.id.action_settings) { Intent intent = new Intent(); intent.setClass(MainActivity.this, SettingsActivity.class); startActivityForResult(intent, kActivityRequestCode_Settings); return true; } else if (id == R.id.action_licenses) { Intent intent = new Intent(this, CommonHelpActivity.class); intent.putExtra("title", getString(R.string.licenses_title)); intent.putExtra("help", "licenses.html"); startActivity(intent); } return super.onOptionsItemSelected(item); }
From source file:com.andrew.apolloMod.activities.QueryBrowserActivity.java
@Override public void onServiceConnected(ComponentName name, IBinder service) { if (mAdapter != null) { getQueryCursor(mAdapter.getQueryHandler(), null); }//from w ww.j a v a 2s . c o m Intent intent = getIntent(); String action = intent != null ? intent.getAction() : null; if (Intent.ACTION_VIEW.equals(action)) { // this is something we got from the search bar Uri uri = intent.getData(); String path = uri.toString(); if (path.startsWith("content://media/external/audio/media/")) { // This is a specific file String id = uri.getLastPathSegment(); long[] list = new long[] { Long.valueOf(id) }; MusicUtils.playAll(this, list, 0); finish(); return; } else if (path.startsWith("content://media/external/audio/albums/")) { // This is an album, show the songs on it Intent i = new Intent(Intent.ACTION_VIEW); i.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track"); i.putExtra("album", uri.getLastPathSegment()); startActivity(i); finish(); return; } else if (path.startsWith("content://media/external/audio/artists/")) { intent = new Intent(Intent.ACTION_VIEW); Bundle bundle = new Bundle(); bundle.putString(MIME_TYPE, Audio.Artists.CONTENT_TYPE); bundle.putString(ARTIST_KEY, uri.getLastPathSegment()); bundle.putLong(BaseColumns._ID, ApolloUtils.getArtistId(uri.getLastPathSegment(), ARTIST_ID, this)); intent.setClass(this, TracksBrowser.class); intent.putExtras(bundle); startActivity(intent); return; } } mFilterString = intent.getStringExtra(SearchManager.QUERY); if (MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action)) { String focus = intent.getStringExtra(MediaStore.EXTRA_MEDIA_FOCUS); String artist = intent.getStringExtra(MediaStore.EXTRA_MEDIA_ARTIST); String album = intent.getStringExtra(MediaStore.EXTRA_MEDIA_ALBUM); String title = intent.getStringExtra(MediaStore.EXTRA_MEDIA_TITLE); if (focus != null) { if (focus.startsWith("audio/") && title != null) { mFilterString = title; } else if (focus.equals(Audio.Albums.ENTRY_CONTENT_TYPE)) { if (album != null) { mFilterString = album; if (artist != null) { mFilterString = mFilterString + " " + artist; } } } else if (focus.equals(Audio.Artists.ENTRY_CONTENT_TYPE)) { if (artist != null) { mFilterString = artist; } } } } setContentView(R.layout.listview); mTrackList = getListView(); mTrackList.setTextFilterEnabled(true); if (mAdapter == null) { mAdapter = new QueryListAdapter(getApplication(), this, R.layout.listview_items, null, // cursor new String[] {}, new int[] {}, 0); setListAdapter(mAdapter); if (TextUtils.isEmpty(mFilterString)) { getQueryCursor(mAdapter.getQueryHandler(), null); } else { mTrackList.setFilterText(mFilterString); mFilterString = null; } } else { mAdapter.setActivity(this); setListAdapter(mAdapter); mQueryCursor = mAdapter.getCursor(); if (mQueryCursor != null) { init(mQueryCursor); } else { getQueryCursor(mAdapter.getQueryHandler(), mFilterString); } } LinearLayout emptyness = (LinearLayout) findViewById(R.id.empty_view); emptyness.setVisibility(View.GONE); }
From source file:org.deviceconnect.android.deviceplugin.host.HostDeviceService.java
/** * ??.//from w w w . j av a2 s .c om * * @return ID */ public int playMedia() { if (mSetMediaType == MEDIA_TYPE_MUSIC) { try { mMediaPlayer.prepare(); if (mMediaStatus == MEDIA_PLAYER_STOP) { mMediaPlayer.seekTo(0); } mMediaPlayer.start(); mMediaStatus = MEDIA_PLAYER_PLAY; } catch (Exception e) { if (BuildConfig.DEBUG) { e.printStackTrace(); } } sendOnStatusChangeEvent("play"); return mMediaPlayer.getAudioSessionId(); } else if (mSetMediaType == MEDIA_TYPE_VIDEO) { String className = getClassnameOfTopActivity(); if (VideoPlayer.class.getName().equals(className)) { mMediaStatus = MEDIA_PLAYER_PLAY; Intent mIntent = new Intent(VideoConst.SEND_HOSTDP_TO_VIDEOPLAYER); mIntent.putExtra(VideoConst.EXTRA_NAME, VideoConst.EXTRA_VALUE_VIDEO_PLAYER_PLAY); this.getContext().sendBroadcast(mIntent); sendOnStatusChangeEvent("play"); } else { mMediaStatus = MEDIA_PLAYER_PLAY; Intent mIntent = new Intent(VideoConst.SEND_HOSTDP_TO_VIDEOPLAYER); mIntent.setClass(getContext(), VideoPlayer.class); Uri data = Uri.parse(myCurrentFilePath); mIntent.setDataAndType(data, myCurrentFileMIMEType); mIntent.putExtra(VideoConst.EXTRA_NAME, VideoConst.EXTRA_VALUE_VIDEO_PLAYER_PLAY); mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(mIntent); sendOnStatusChangeEvent("play"); } return 0; } else { return 0; } }
From source file:com.mobiletin.inputmethod.indic.LatinIME.java
private void launchSettings() { mInputLogic.commitTyped(mSettings.getCurrent(), LastComposedWord.NOT_A_SEPARATOR); requestHideSelf(0);/*from w w w . ja va2 s .c o m*/ final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); if (mainKeyboardView != null) { mainKeyboardView.closing(); } final Intent intent = new Intent(); intent.setClass(LatinIME.this, SettingsActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(SettingsActivity.EXTRA_SHOW_HOME_AS_UP, false); startActivity(intent); }
From source file:com.ichi2.anki.DeckPicker.java
private void openStudyOptions(boolean withDeckOptions) { if (mFragmented) { // The fragment will show the study options screen instead of launching a new activity. loadStudyOptionsFragment(withDeckOptions); } else {//from w ww .jav a 2s .c o m Intent intent = new Intent(); intent.putExtra("withDeckOptions", withDeckOptions); intent.setClass(this, StudyOptionsActivity.class); startActivityForResultWithAnimation(intent, SHOW_STUDYOPTIONS, ActivityTransitionAnimation.LEFT); } }