<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.littlejie.demo">
<!-- 读写权限 -->
<!-- 用于读取浏览器分享时生成的屏幕截图 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:name=".modules.DemoApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- some other thing -->
<!-- 注册 Intent,用于接受浏览器分享 -->
<activity
android:name=".modules.advance.BrowserScreenShotActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<!-- 发送多个数据 -->
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="*/*"/>
</intent-filter>
</activity>
</application>
</manifest>
@Override
protected void onResume() {
super.onResume();
if (getIntent() == null) {
return;
}
Uri screenShot = getIntent().getExtras().getParcelable("screen_shot_as_stream");
if (screenShot == null) {
ToastUtil.showDefaultToast("获取浏览器截屏失败~");
return;
}
try {
//授权Uri的读取权限
//若不授权,在 Android 6.0 以上测试崩溃
//https://thinkandroid.wordpress.com/2012/08/07/granting-content-provider-uri-permissions/
//第一个参数为需要授权的apk包名
grantUriPermission("com.littlejie.demo", screenShot, Intent.FLAG_GRANT_READ_URI_PERMISSION);
//通过 Uri 获取截屏图片的输入流
InputStream is = getContentResolver().openInputStream(screenShot);
mIvScreenShot.setImageBitmap(BitmapFactory.decodeStream(is));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有