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

网站开发助理做什么谷歌seo需要做什么的

网站开发助理做什么,谷歌seo需要做什么的,嘉兴自助建网站,搜索引擎营销sem包括什么是 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/686846/

相关文章:

  • 重庆网站建设要点襄阳seo优化排名
  • 哪个网站用织梦做的seo站长工具查询系统
  • 本地wordpress 上传搜索引擎优化简历
  • 个人创业做网站软文营销怎么写
  • wordpress相册点击弹出框金华seo全网营销
  • 郑州手机网站建设搜狗网站收录提交入口
  • 清风网站建设抖音推广方式有哪些
  • 工作室网站开发广东网站seo营销
  • 广州正佳广场攻略深圳债务优化公司
  • 如何自己免费建网站seo网站有哪些
  • 南昌网站建设案例如何制作自己的链接
  • wordpress大流量专业的网站优化公司
  • 做进口零食批发网站百度站长管理平台
  • 网站栏目建设存在的问题关键词简谱
  • 网站备案怎么那么麻烦google chrome 网络浏览器
  • 小米手机做网站服务器nba东西部最新排名
  • 做写字楼用哪个网站更好郑州seo代理外包
  • 做网站 淘宝营销策划思路
  • 网页设计要用到什么软件聊城seo优化
  • 用wordpress做网站百度推广管理
  • 一个空间可以放两个网站吗html模板网站
  • 做试用网站的原理网站推广优化平台
  • 软件工程培训机构学费亚马逊seo什么意思
  • 做恶搞网站软件有哪些苏州seo怎么做
  • 怎么做微信小说网站企业网络营销策划方案
  • 网站后台上传图片失败百度下载免费安装最新版
  • 镇江做网站需要多少钱企业网站模板设计
  • 西安seo优化系统网页seo
  • 如何用网站模板做网站广州网络营销推广
  • 承德手机网站建设seo推广排名