List of usage examples for android.content Intent setType
public @NonNull Intent setType(@Nullable String type)
From source file:com.example.igorklimov.popularmoviesdemo.fragments.DetailFragment.java
private Intent createShareIntent() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, "#Popular Movies app https://www.youtube.com/watch?v=" + mTrailerUri); return intent; }
From source file:com.dvn.vindecoder.ui.seller.AddVehicalAndPayment.java
private void startDilog() { AlertDialog.Builder myAlertDilog = new AlertDialog.Builder(AddVehicalAndPayment.this); myAlertDilog.setTitle("Upload picture option.."); myAlertDilog.setMessage("Take Photo"); myAlertDilog.setPositiveButton("Gallery", new DialogInterface.OnClickListener() { @Override/* w w w .j av a 2 s. c om*/ public void onClick(DialogInterface dialog, int which) { Intent picIntent = new Intent(Intent.ACTION_GET_CONTENT, null); picIntent.setType("image/*"); picIntent.putExtra("return_data", true); startActivityForResult(picIntent, GALLERY_REQUEST); } }); myAlertDilog.setNegativeButton("Camera", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (checkPermission(Manifest.permission.CAMERA, AddVehicalAndPayment.this)) { openCameraApplication(); } else { requestPermission(AddVehicalAndPayment.this, new String[] { Manifest.permission.CAMERA }, REQUEST_ACESS_CAMERA); } } else { openCameraApplication(); } } }); myAlertDilog.show(); }
From source file:com.cloverstudio.spika.CameraCropActivity.java
private void getImageIntents() { /*/* w w w.ja v a 2s . c o m*/ * if (getIntent().hasExtra("trio")) { _trio = true; _groupId = * getIntent().getStringExtra("groupId"); _planner = * getIntent().getBooleanExtra("planner", false); } else { _trio = * false; _planner = false; _groupId = ""; } */ if (getIntent().getStringExtra("type").equals("gallery")) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); this.startActivityForResult(intent, GALLERY); mIsCamera = false; } else { try { startCamera(); mIsCamera = true; } catch (UnsupportedOperationException ex) { ex.printStackTrace(); Toast.makeText(getBaseContext(), "UnsupportedOperationException", Toast.LENGTH_SHORT).show(); } } if (getIntent().getBooleanExtra("profile", false) == true) { mForProfile = true; } else { mForProfile = false; } if (getIntent().getBooleanExtra("createGroup", false) == true) { mForGroup = true; } else { mForGroup = false; } if (getIntent().getBooleanExtra("groupUpdate", false) == true) { mForGroupUpdate = true; } else { mForGroupUpdate = false; } }
From source file:info.androidhive.slidingmenu.Games.WordSearch.wordsearch.view.WordSearchActivity.java
/** when menu button option selected */ @Override//ww w . ja v a 2 s .com public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_scores: this.showDialog(DIALOG_ID_HIGH_SCORES_LOCAL_SHOW); return true; case R.id.menu_options: startActivity(new Intent(this, WordSearchPreferences.class)); return true; case R.id.menu_new: control.newWordSearch(); return true; case R.id.menu_custom: { Intent intent = new Intent(Intent.ACTION_EDIT, WordDictionaryProvider.Word.CONTENT_URI); intent.setType(WordDictionaryProvider.Word.CONTENT_TYPE); this.startActivity(intent); return true; } case R.id.menu_tutorial: { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClass(this, TutorialActivity.class); startActivity(intent); return true; } case R.id.menu_donate: { this.showDialog(DIALOG_ID_DONATE); return true; } default: return super.onOptionsItemSelected(item); } }
From source file:nl.sogeti.android.gpstracker.actions.ShareTrack.java
private void sendTwidroidTweet(String tweet) { final Intent intent = new Intent("com.twidroid.SendTweet"); intent.putExtra("com.twidroid.extra.MESSAGE", tweet); intent.setType("application/twitter"); try {//from ww w.j a v a 2 s. c o m startActivity(intent); ShareTrack.this.finish(); } catch (ActivityNotFoundException e) { showDialog(DIALOG_INSTALL_TWIDROID); } }
From source file:net.gerosyab.dailylog.activity.MainActivity.java
private void exportCategory(final long id) { //?? ? ?? csv //? ?? ?? //from www . j a v a2s . co m // ? ? ? ? Category category = categories.get((int) id); ProgressDialog progressDialog = new ProgressDialog(MainActivity.this); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setTitle("Exporting data [" + category.getName() + "]"); progressDialog.show(); String filename = category.getName() + "" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".data"; FileOutputStream outputStream = null; File resultFilePath = null; File resultFile = null; CSVWriter cw = null; try { resultFile = new File(context.getCacheDir(), filename); outputStream = new FileOutputStream(resultFile.getAbsolutePath()); // cw = new CSVWriter(new OutputStreamWriter(outputStream, "UTF-8"),'\t', '"'); cw = new CSVWriter(new OutputStreamWriter(outputStream, "UTF-8"), ',', '"'); // Export Data String[] metaDataStr = { "Version:" + AppDatabase.VERSION, "Name:" + category.getName(), "Unit:" + category.getUnit(), "Type:" + category.getRecordType(), "DefaultValue:" + category.getDefaultValue(), "Columns:date(yyyy-MM-dd 24HH:mm:ss)/value(boolean|numeric|string)" }; cw.writeNext(metaDataStr); List<Record> records = category.getRecordsOrderByDateAscending(realm); for (Record record : records) { String value = null; if (category.getRecordType() == StaticData.RECORD_TYPE_BOOLEAN) { value = "true"; } else if (category.getRecordType() == StaticData.RECORD_TYPE_NUMBER) { value = "" + record.getNumber(); } else if (category.getRecordType() == StaticData.RECORD_TYPE_MEMO) { value = record.getString(); } String[] s = { record.getDateString(StaticData.fmtForBackup), value }; cw.writeNext(s); } cw.close(); outputStream.close(); progressDialog.dismiss(); Uri fileUri = FileProvider.getUriForFile(context, "net.gerosyab.dailylog.fileprovider", resultFile); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri); shareIntent.setType("text/plain"); startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))); } catch (UnsupportedEncodingException e) { Log.e("DailyLog", e.getMessage()); e.printStackTrace(); } catch (IllegalArgumentException e) { Log.e("DailyLog", e.getMessage()); e.printStackTrace(); } catch (Exception e) { Log.e("DailyLog", e.getMessage()); e.printStackTrace(); } finally { progressDialog.dismiss(); } }
From source file:br.com.anteros.vendas.gui.AnexoCadastroActivity.java
/** * Seleciona outros tipos de arquivos para anexar *///from w w w. jav a 2 s. com private void selecionarOutrosTiposArquivo() { Intent intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("file/*"); startActivityForResult(Intent.createChooser(intent, "Selecione"), SELECIONAR_ARQUIVO); }
From source file:com.dahl.brendan.wordsearch.view.WordSearchActivity.java
/** when menu button option selected */ @Override//from w ww.jav a2 s .c om public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_scores: this.showDialog(DIALOG_ID_HIGH_SCORES_LOCAL_SHOW); return true; case R.id.menu_options: startActivity(new Intent(this, WordSearchPreferences.class)); return true; case R.id.menu_new: control.newWordSearch(); return true; case R.id.menu_custom: { Intent intent = new Intent(Intent.ACTION_EDIT, Word.CONTENT_URI); intent.setType(Word.CONTENT_TYPE); this.startActivity(intent); return true; } case R.id.menu_tutorial: { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClass(this, TutorialActivity.class); startActivity(intent); return true; } case R.id.menu_donate: { this.showDialog(DIALOG_ID_DONATE); return true; } default: return super.onOptionsItemSelected(item); } }
From source file:com.support.android.designlibdemo.activities.CampaignDetailActivity.java
public void setupShareIntent() { // Fetch Bitmap Uri locally ImageView ivImage = (ImageView) findViewById(R.id.ivCampaighnImage); // Get access to the URI for the bitmap Uri bmpUri = getLocalBitmapUri(ivImage); if (bmpUri != null) { // Construct a ShareIntent with link to image Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); shareIntent.putExtra(Intent.EXTRA_SUBJECT, campaign.getTitle()); shareIntent.putExtra(Intent.EXTRA_TEXT, campaign.getCampaignUrl()); shareIntent.setType("image/*"); // Launch sharing dialog for image startActivity(Intent.createChooser(shareIntent, "send")); } else {// w w w . j a v a2 s . co m Toast.makeText(this, "Some error occured during sharing", Toast.LENGTH_LONG).show(); } }