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

安卓浏览器区分启动、打开、分享

 搞了几个钟头,终于全兼容了,分享有2种类型!

void getDataFromIntent(Intent intent) {if (intent.getAction().equals(Intent.ACTION_VIEW)) {urln = intent.getDataString();if (urln != null) {if (urln.contains("\n"))urln = urln.substring(urln.indexOf("\n") + 1);newWindow(urln);}} else if (intent.getAction().equals(Intent.ACTION_SEND)) {Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);if (uri != null) {try {urln = URLDecoder.decode(uri.toString(), "UTF-8");} catch (Exception e) {Log.e(Thread.currentThread().getStackTrace()[2] + "", e.toString());}} else {urln = intent.getStringExtra(Intent.EXTRA_TEXT);}if (urln != null) {if (urln.contains("\n"))urln = urln.substring(urln.indexOf("\n") + 1);newWindow(urln);}} else if (intent.getCategories().contains(Intent.CATEGORY_LAUNCHER) && list_webView.isEmpty()) {String surl = sharedPreferences.getString("homepage", "file:///android_asset/home.htm");if (surl.isEmpty())surl = "file:///android_asset/home.htm";newWindow(surl);}
}@Override
protected void onNewIntent(Intent intent) {Log.e(Thread.currentThread().getStackTrace()[2] + "", "onNewIntent(" + getIntent() + ")");super.onNewIntent(intent);setIntent(intent);getDataFromIntent(intent);
}

http://www.lryc.cn/news/379527.html

相关文章:

  • C/C++ 数组负数下标
  • 钓鱼网站开发原理(社会工程学)
  • 如何优雅地使用 console.log 打印数组或对象
  • 模式分解的概念(下)-无损连接分解的与保持函数依赖分解的定义和判断、损失分解
  • vue3父组件获取子组件的实例对象
  • 主流框架选择:React、Angular、Vue的详细比较
  • 交易者的意义是什么?
  • io_uring
  • 构建高并发Web应用:基于Gunicorn、Flask和Docker的部署指南
  • 【Ruby简单脚本02】双色球系统
  • Netty ByteBuf 使用详解
  • 怎样去掉卷子上的答案并打印
  • 海思SS928/SD3403开发笔记1——使用串口调试开发板
  • JSON数据操作艺术
  • 如何验证Rust中的字符串变量在超出作用域时自动释放内存?
  • 55.Python pip install 安装失败的一个情况Requirement already satisfied
  • Axios进阶
  • C++ 丑数
  • 小山菌_代码随想录算法训练营第三十天|122.买卖股票的最佳时机II、55. 跳跃游戏 、45.跳跃游戏II、1005.K次取反后最大化的数组和
  • SpringMVC系列七: 手动实现SpringMVC底层机制-上
  • 嵌入式web 服务器boa的编译和移植
  • 什么是js?特点是什么?组成部分?
  • Java 面试题:如何保证集合是线程安全的? ConcurrentHashMap 如何实现高效地线程安全?
  • 打工人的PPT救星来了!用这款AI工具,10秒生成您的专属PPT
  • GIT 合拼
  • 利用 Python 和 AI 技术制作智能问答机器人
  • electron系列(一)调用dll
  • VUE3实现个人网站模板源码
  • C语言 | Leetcode C语言题解之第162题寻找峰值
  • 利用pickle保存和加载对象