List of usage examples for android.content Intent getFlags
public @Flags int getFlags()
From source file:org.readium.sdk.android.launcher.NavigationTableActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.table_of_contents); context = this; back = (Button) findViewById(R.id.backToBookView6); Intent intent = getIntent(); if (intent.getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) { Bundle extras = intent.getExtras(); if (extras != null) { String value = extras.getString(Constants.BOOK_NAME); back.setText(value);// w ww . j av a 2 s . co m containerId = extras.getLong(Constants.CONTAINER_ID); Container container = ContainerHolder.getInstance().get(containerId); if (container == null) { finish(); return; } pckg = container.getDefaultPackage(); } } final ListView items = (ListView) findViewById(R.id.tableOfContents); this.setListViewContent(items, getNavigationTable()); initListener(); }
From source file:com.playhaven.android.diagnostic.test.PHTestCase.java
@SuppressWarnings("unchecked") protected ACTIVITY startActivitySync(Class<ACTIVITY> clazz) { Intent intent = new Intent(getInstrumentation().getTargetContext(), clazz); intent.setFlags(intent.getFlags() | FLAG_ACTIVITY_NEW_TASK); return (ACTIVITY) getInstrumentation().startActivitySync(intent); }
From source file:com.hanuor.sapphire.hub.SapphireIntentHandler.java
@SuppressLint("NewApi") @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB) public void setIntent(String keyTag, Intent intentObject) throws JsonProcessingException { String getJSON = intentationPrime.intentToJSON(context, intentObject); Log.d("Valhalla", getJSON); Log.d("VALHALLA", "" + intentObject.getFlags()); // suggestionTempDBHandler.insertData(keyTag, getJSON); }
From source file:com.rorlig.babyapp.ui.fragment.InjectableFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_settings: startActivity(new Intent(getActivity(), PrefsActivity.class)); return true; case R.id.action_licenses: startActivity(new Intent(getActivity(), LicenseActivity.class)); return true; case R.id.action_tutorial: Intent tutorialIntent = new Intent(getActivity(), TutorialActivity.class); // Bundle args = new Bundle(); // args.putBoolean("fromLauncher", false); tutorialIntent.putExtra("fromLauncher", false); startActivity(tutorialIntent);//w ww . j a va 2 s . com return true; case R.id.action_logout: ParseUser.logOutInBackground(); // new LogOutCallback() { // @Override // public void done(ParseException e) { Log.d(TAG, "logging out from parse"); clearUserInfo(); Intent intent = new Intent(getActivity().getApplicationContext(), LoginActivity.class); intent.setFlags( intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); return true; // } // }); } return super.onOptionsItemSelected(item); }
From source file:com.jefftharris.passwdsafe.StorageFileListFragment.java
/** Open a password file URI from an intent */ private void openUri(Intent openIntent) { Uri uri = openIntent.getData();//from ww w .java2 s .c om int flags = openIntent.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); Context ctx = getContext(); String title = RecentFilesDb.getSafDisplayName(uri, ctx); RecentFilesDb.updateOpenedSafFile(uri, flags, ctx); if (title != null) { openUri(uri, title); } }
From source file:com.uphyca.kitkat.storage.ui.MainFragment.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override/* w w w .j av a2s . c o m*/ public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == Activity.RESULT_OK && data.getData() != null) { int takeFlags = data.getFlags(); takeFlags &= (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // Check for the freshest data. getActivity().getContentResolver().takePersistableUriPermission(data.getData(), takeFlags); } switch (requestCode) { case REQUEST_OPEN: onOpenRequestResult(resultCode, data); return; case REQUEST_EDIT: case REQUEST_CREATE: onEditRequestResult(resultCode, data); return; case REQUEST_DELETE: onDeleteRequestResult(resultCode, data); return; default: super.onActivityResult(requestCode, resultCode, data); } }
From source file:de.unclenet.dehabewe.CalendarActivity.java
private void gotAccount(final AccountManager manager, final Account account) { SharedPreferences settings = getSharedPreferences(PREF, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString("accountName", account.name); editor.commit();//from w w w . j ava 2s .co m new Thread() { @Override public void run() { try { final Bundle bundle = manager.getAuthToken(account, AUTH_TOKEN_TYPE, true, null, null) .getResult(); runOnUiThread(new Runnable() { public void run() { try { if (bundle.containsKey(AccountManager.KEY_INTENT)) { Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT); int flags = intent.getFlags(); flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK; intent.setFlags(flags); startActivityForResult(intent, REQUEST_AUTHENTICATE); } else if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) { authenticatedClientLogin(bundle.getString(AccountManager.KEY_AUTHTOKEN)); } } catch (Exception e) { handleException(e); } } }); } catch (Exception e) { handleException(e); } } }.start(); }
From source file:com.mokee.setupwizard.SetupWizardActivity.java
private void finishSetup() { Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1); enableStatusBar();/*from ww w .j a va 2s.co m*/ Intent intent = new Intent("android.intent.action.MAIN"); intent.addCategory("android.intent.category.HOME"); disableSetupWizards(intent); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | intent.getFlags()); startActivity(intent); finish(); }
From source file:com.allmycode.flags.other.MyActivityOther.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);/*from w w w . j a va 2s . co m*/ targetActivity = (EditText) findViewById(R.id.editText1); flags = (EditText) findViewById(R.id.editText2); cheatSheet = (EditText) findViewById(R.id.editText3); for (String item : flagsList) { cheatSheet.append(item); cheatSheet.append("\n"); } Intent whoCalled = getIntent(); helloView = ((TextView) findViewById(R.id.textView3)); helloView.setTextColor(android.graphics.Color.WHITE); helloView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); helloView.setText("Flags: 0x" + Integer.toHexString(whoCalled.getFlags())); if (whoCalled.getExtras() != null) { boolean areErrors = whoCalled.getExtras().getBoolean("existErrors", false); if (areErrors) { helloView.append(" There were errors!"); helloView.setTextColor(android.graphics.Color.RED); helloView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); } } ActivityManager am = (ActivityManager) getSystemService(Service.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> processes; processes = am.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo info : processes) { Log.i("Process:", info.processName); } }
From source file:com.zhongzilu.bit100.view.activity.EditorActivity.java
private void getIntentData() { Intent intent = this.getIntent(); int flags = intent.getFlags(); if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) { if (intent.getAction() != null && Intent.ACTION_VIEW.equals(intent.getAction())) { if (SCHEME_FILE.equals(intent.getScheme())) { // // String type = getIntent().getType(); // mImportingUri=file:///storage/emulated/0/Vlog.xml intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); Uri uri = intent.getData(); if (uri != null && SCHEME_FILE.equalsIgnoreCase(uri.getScheme())) { // currentFilePath = FileUtils.uri2FilePath(getBaseContext(), uri); }// ww w .j a v a 2 s . c om } } } }