当前位置: 首页 > news >正文

做网站效果图总结做报告的网站

做网站效果图总结,做报告的网站,宁波网页设计哪家好,公司请人做公司网站会计分录什么是 Android 系统的原生分享呢#xff0c;如下图所示 创建一个 Intent #xff0c;指定其 Action 为 Intent.ACTION_SEND#xff0c;这表示要创建一个发送指定内容的行动。 Intent sendIntent new Intent(); sendIntent.setAction(Intent.ACTION_SEND); 指定需要发送的…什么是 Android 系统的原生分享呢如下图所示 创建一个 Intent 指定其 Action 为 Intent.ACTION_SEND这表示要创建一个发送指定内容的行动。 Intent sendIntent new Intent(); sendIntent.setAction(Intent.ACTION_SEND); 指定需要发送的内容和类型。 // 比如发送文本形式的数据内容 // 指定发送的内容 sendIntent.putExtra(Intent.EXTRA_TEXT, This is my text); // 指定发送内容的类型 sendIntent.setType(text/plain); // 比如发送二进制文件数据流内容比如图片、视频、音频文件等等 // 指定发送的内容 (EXTRA_STREAM 对于文件 Uri ) shareIntent.putExtra(Intent.EXTRA_STREAM, uri); // 指定发送内容的类型 (MIME type) shareIntent.setType(image/jpeg); 向系统发送Activity打开系统分享选择器出现如上图所示界面。  startActivity(Intent.createChooser(shareIntent, Share)); 完整代码如下 // 原生通用分享文本 public void shareText(String title, String text){Intent sendIntent new Intent();sendIntent.setAction(Intent.ACTION_SEND);if (title.isEmpty()){title share;}sendIntent.putExtra(Intent.EXTRA_TEXT, text);sendIntent.setType(text/plain);startActivityForResult(Intent.createChooser(sendIntent, title), 80001); }// 原生通用分享图片 public void shareImage(String title, String filePath){Intent sendIntent new Intent();sendIntent.setAction(Intent.ACTION_SEND);if (title.isEmpty()){title share;}File file new File(filePath);Uri uri getFileUri(this, file);sendIntent.putExtra(Intent.EXTRA_STREAM, uri);sendIntent.setType(image/png);startActivityForResult(Intent.createChooser(sendIntent, title), 80002); }public Uri getFileUri(Context context, File file){Uri uri;// 低版本直接用 Uri.fromFileif (Build.VERSION.SDK_INT Build.VERSION_CODES.N) {uri Uri.fromFile(file);}else {try {uri FileProvider.getUriForFile(this, getPackageName0() .fileProvider, file);} catch (Exception e) {e.printStackTrace();uri getImageContentUri(context, file);}if (uri null) {uri getImageContentUri(context, file);}}return uri; }public Uri getImageContentUri(Context context, File imageFile) {String filePath imageFile.getAbsolutePath();Cursor cursor context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,new String[] { MediaStore.Images.Media._ID }, MediaStore.Images.Media.DATA ? ,new String[] { filePath }, null);if (cursor ! null cursor.moveToFirst()) {int id cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));Uri baseUri Uri.parse(content://media/external/images/media);return Uri.withAppendedPath(baseUri, id);} else {if (imageFile.exists()) {ContentValues values new ContentValues();values.put(MediaStore.Images.Media.DATA, filePath);return context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);} else {return null;}} }如果要分享到指定的app呢 // 特定App 分享文本 public void shareTextByApp(String pkgName, String appName, String title, String text){if (!checkAppInstalled(this, pkgName)){Toast.makeText(getApplicationContext(), You need install the appName first, Toast.LENGTH_LONG).show();return;}if (title.isEmpty()){title share;}Intent sendIntent new Intent();sendIntent.setAction(Intent.ACTION_SEND);sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, title);sendIntent.putExtra(Intent.EXTRA_TEXT, text);sendIntent.setType(text/plain);sendIntent.setPackage(pkgName);startActivity(sendIntent); }// 特定App 分享文本 public void shareImageByApp(String pkgName, String appName, String title, String filePath){if (!checkAppInstalled(this, pkgName)){Toast.makeText(getApplicationContext(), You need install the appName first, Toast.LENGTH_LONG).show();return;}if (title.isEmpty()){title share;}Intent sendIntent new Intent();sendIntent.setAction(Intent.ACTION_SEND);sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, title);File file new File(filePath);Uri uri getFileUri(this, file);sendIntent.putExtra(Intent.EXTRA_STREAM, uri);sendIntent.setType(image/png);sendIntent.setPackage(pkgName);startActivity(sendIntent); }// 是否安装某app public boolean checkAppInstalled(Context context, String pkgName) {try {context.getPackageManager().getPackageInfo(pkgName, 0);} catch (Exception x) {return false;}return true; } //例如 WhatsApp 的分享 shareTextByApp(com.whatsapp, WhatsApp, title, content);//Facebook 的分享 shareImageByApp(com.facebook.katana, Facebook, title, filePath);
http://www.hkea.cn/news/14338751/

相关文章:

  • 交通局网站建设方案策划书电商网站规划
  • 机械加工类网站怎么做东营网站排名优化公司
  • 一个网站怎么建设沈阳室内设计公司
  • 宁波网站推广厂家排名网站优化哪里可以做
  • app营销宁波网站建设优化的公司排名
  • 对门户网站建设情况的报告建设银行信用卡积分兑换网站
  • 河南省建设工程质量安全监督网站西安网站制作公司有哪家
  • 西安做网站的公司建设优秀企业网站
  • 东莞网站建设网站推广软件工程师招聘简章pdf免费
  • wordpress 亚马逊插件杭州seo薪资水平
  • 做dota2菠菜网站wordpress twilight saga 主题
  • 公司做网站的作用电气行业网站建设多少钱
  • 上海做网站找谁成都网站营销seo电话
  • 南通优普网站建设团队黑龙江企业网站建设公司
  • 如何做属于自己的领券网站做教育网站的er图
  • 吉林省交通建设集团有限公司网站凌河网站建设推广
  • 贵州省建设厅网站多少wordpress 笔记
  • 免费自助开通网站外国人做中国数学视频网站
  • 汕尾市企业网站seo点击软件外贸网络推广是什么
  • 泰安网站开发公司网上开店的货源渠道有哪些
  • 有域名了也备案了怎么做网站网络热词排行榜
  • 手机网站自适应分辨率wordpress 备份主题
  • 宁波制作网站企业有哪些可以做微课PPT模板 网站
  • 湖州集团网站建设达州建设机械网站
  • php网站开发实例视频教程大专毕业设计怎么做
  • 深圳官方网站泰安房产最新网签情况
  • 做网站的天空网嘉兴丝绸大厦做网站的公司
  • 郑州做网站要多少钱个人网页免费域名注册入口
  • 纯html网站开发工具深圳网站建设 合作品牌
  • php网站开发环境一威海市网站建设