/** * 分享链接 */ public static void shareLink(String url, String title, Context context) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "分享"); intent.putExtra(Intent.EXTRA_TEXT, "非官方开源哔哩哔哩动画安卓客户端,GitHub地址:" + url); context.startActivity(Intent.createChooser(intent, title)); } }
private void startShareIntentChooser(Uri heapDumpUri) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("application/octet-stream"); intent.putExtra(Intent.EXTRA_STREAM, heapDumpUri); startActivity(Intent.createChooser(intent, getString(R.string.leak_canary_share_with))); }
public static void shareTrack(final Context context, long id) { try { Intent share = new Intent(Intent.ACTION_SEND); share.setType("audio/*"); share.putExtra(Intent.EXTRA_STREAM, getSongUri(context, id)); context.startActivity(Intent.createChooser(share, "Share")); } catch (Exception e) { e.printStackTrace(); } }
public void onContact(View view) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:liyujiang_tk@yeah.net")); intent.putExtra(Intent.EXTRA_CC, new String[] {"1032694760@qq.com"}); intent.putExtra(Intent.EXTRA_EMAIL, ""); intent.putExtra(Intent.EXTRA_TEXT, "欢迎提供意您的见或建议"); startActivity(Intent.createChooser(intent, "选择邮件客户端")); }
@Override public void onClick(View v) { Intent intent = new Intent(); intent.setType(TYPE_IMAGE); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, SELECT_PICTURE), PICK_IMAGE); } });
@Override @SuppressLint("InlinedApi") public void showPickAttachmentDialog(int requestCode) { requestCode |= REQUEST_MASK_ATTACHMENT_PRESENTER; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); isInSubActivity = true; startActivityForResult(Intent.createChooser(i, null), requestCode); }
private void onImport() { Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); startActivityForResult(Intent.createChooser(i, null), ACTIVITY_REQUEST_PICK_SETTINGS_FILE); }
@Override public void onClick(View v) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("http://music.baidu.com/songlist/" + playlsitId)); shareIntent.setType("html/*"); startActivity(Intent.createChooser(shareIntent, getResources().getString(R.string.shared_to))); } });
private void shareHeapDump(BlockInfoEx blockInfo) { File heapDumpFile = blockInfo.logFile; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { heapDumpFile.setReadable(true, false); } Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("application/octet-stream"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(heapDumpFile)); startActivity(Intent.createChooser(intent, getString(R.string.block_canary_share_with))); }
private void shareUrl(String subject, String url) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, url); startActivity(Intent.createChooser(intent, getString(R.string.share_dialog_title))); }
protected void shareUrl(String subject, String url) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, url); startActivity(Intent.createChooser(intent, getString(R.string.share_dialog_title))); } }
void sendIt(String theMessage) { Intent i=new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, R.string.share_subject); i.putExtra(Intent.EXTRA_TEXT, theMessage); startActivity(Intent.createChooser(i, getString(R.string.share_title))); } }
void sendIt(String theMessage) { Intent i=new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, R.string.share_subject); i.putExtra(Intent.EXTRA_TEXT, theMessage); startActivity(Intent.createChooser(i, getString(R.string.share_title))); } }
void shareLeak() { AnalyzedHeap visibleLeak = getVisibleLeak(); String leakInfo = leakInfo(this, visibleLeak.heapDump, visibleLeak.result, true); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, leakInfo); startActivity(Intent.createChooser(intent, getString(R.string.leak_canary_share_with))); }
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent i; switch (item.getItemId()) { case R.id.viewGithub: i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart")); startActivity(i); break; case R.id.report: i = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( "mailto", "philjay.librarysup@gmail.com", null)); i.putExtra(Intent.EXTRA_SUBJECT, "MPAndroidChart Issue"); i.putExtra(Intent.EXTRA_TEXT, "Your error report here..."); startActivity(Intent.createChooser(i, "Report Problem")); break; case R.id.website: i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("http://at.linkedin.com/in/philippjahoda")); startActivity(i); break; } return true; } }
protected void openUrlInBrowser(String url) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(Intent.createChooser(intent, activity.getString(R.string.share_dialog_title))); }
@OnClick(R.id.btn_share) void share() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "分享"); intent.putExtra(Intent.EXTRA_TEXT, "来自「哔哩哔哩」的分享:" + mVideoDetailsInfo.getDesc()); startActivity(Intent.createChooser(intent, mVideoDetailsInfo.getTitle())); } }
private void shareBlock(BlockInfoEx blockInfo) { String leakInfo = blockInfo.toString(); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, leakInfo); startActivity(Intent.createChooser(intent, getString(R.string.block_canary_share_with))); }
private void startGalleryActivity() { tempUri = null; Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); String selectPicture = getResources().getString(R.string.select_picture); startActivityForResult(Intent.createChooser(intent, selectPicture), getRequestCode()); }
@Test public void createChooser_shouldWrapIntent() throws Exception { Intent originalIntent = new Intent(Intent.ACTION_BATTERY_CHANGED, Uri.parse("foo://blah")); Intent chooserIntent = Intent.createChooser(originalIntent, "The title"); assertThat(chooserIntent.getAction()).isEqualTo(Intent.ACTION_CHOOSER); assertThat(chooserIntent.getStringExtra(Intent.EXTRA_TITLE)).isEqualTo("The title"); assertThat((Intent) chooserIntent.getParcelableExtra(Intent.EXTRA_INTENT)) .isSameAs(originalIntent); }