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

建站中企动力seo到底是什么

建站中企动力,seo到底是什么,wordpress模板 购买,使用php做网站什么是 Android 系统的原生分享呢,如下图所示 创建一个 Intent ,指定其 Action 为 Intent.ACTION_SEND,这表示要创建一个发送指定内容的行动。 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/171276/

相关文章:

  • 专做女装的网站网站备案是什么意思
  • 没有网站可以做seo排名吗小学生简短小新闻摘抄
  • 做程序网站需要什么代码宁波seo搜索排名优化
  • 网站建设开发语言新冠病毒最新消息
  • 怎么做1688网站网页制作工具有哪些
  • 一个网站的主题和设计风格最好用的免费建站平台
  • 网站开发主页手机优化游戏性能的软件
  • 怎么做属于自己的域名网站网络策划方案
  • destoon做的网站百度商务合作联系
  • 金山区网站制作网络营销策划书1500字
  • 厦门网站建设制作工具熊猫关键词挖掘工具
  • 徐州网站建设 网站推广百度首页快速排名系统
  • 在线转格式网站怎么做拼多多seo 优化软件
  • 成都理工疫情最新消息贵港seo
  • 网站如何防止攻击怎么自己做一个小程序
  • 企业网站建设英文百度收录
  • wordpress查版本sem和seo的区别
  • 网站设计说明书怎么写网站建设平台官网
  • 有建网站的软件阿里云域名注册万网
  • 站长工具排名分析怎么创建公司网站
  • 网站建设标书四川seo哪里有
  • 接网站开发做多少钱建一个外贸独立站大约多少钱
  • wordpress表单录入seo报告
  • python做网站显示表格星巴克seo网络推广
  • 一个com的网站多少钱管理微信软件
  • 蒙阴网站建设软文代写网
  • 用python做一旅游网站南昌seo计费管理
  • 湖北省建设厅win10优化软件哪个好
  • 湖南企业建站系统平台软文有哪些发布平台
  • 南通 网络 公司网站真正免费建站