Action, data uri, category, component, extras
Example mas intent
ACTION_VIEW
geo:47.6, -122.3
Example dial intent
ACTION_DIAL
tel:2125551212
Common intent guide
https://developer.android.com/guide/components/intents-common.html?utm_source=udacity&utm_medium=course&utm_campaign=android_basics
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | static final int REQUEST_IMAGE_CAPTURE = 1 ; static final Uri mLocationForPhotos; public void capturePhoto(String targetFilename) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.withAppendedPath(mLocationForPhotos, targetFilename)); if (intent.resolveActivity(getPackageManager()) != null ) { startActivityForResult(intent, REQUEST_IMAGE_CAPTURE); } } @Override protected void onActivityResult( int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) { Bitmap thumbnail = data.getParcelable( "data" ); // Do other work with full size photo saved in mLocationForPhotos ... } } |
1 2 3 4 5 6 7 8 | public void submitOrder(View view){ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse( "geo:47.6, 122.3" )); if (intent.resolveActivity(getPackageManager()) != null ){ startActivity(intent); } } |