点击按钮打开一个新的窗口 关键词(Intent, setData , putExtra , startActivity |Bundle)
M3U8_Video_demo 项目
//------------------ 创建发送
private void playVideo(String source, String title) {
if (source == null || source.equals("")) {
Toast.makeText(this, "视频内容不存在!", Toast.LENGTH_LONG).show();
source = "http://ad.i5suoi.com/video/94.m3u8";
Intent intent = new Intent(this, VideoActivity.class);//VideoActivity 是一个完整的xml 窗口
intent.setData(Uri.parse(source));
intent.putExtra("mVideoTitle", title);
startActivity(intent);
} else {
Intent intent = new Intent(this, VideoActivity.class);
intent.setData(Uri.parse(source));//m3u8链接 链接都必须Uri.parse 处理吧? intent.putExtra("mVideoTitle", title);//播放标题
startActivity(intent);//开始新窗体?
}
}
//-----------------接收
初始化的时候调用
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.play_video); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, POWER_LOCK); Uri uriPath = getIntent().getData();//m3u8链接
mVideoTitle = getIntent().getStringExtra("mVideoTitle");//播放标题
if (null != uriPath) {
String scheme = uriPath.getScheme();
if (null != scheme) {
mVideoSource = uriPath.toString();
} else {
mVideoSource = uriPath.getPath();
}
} initUI();
android-tivi github项目
///-----方法2
protected Void doInBackground(Integer... params) {//创建
int id = params[0];
intent = new Intent(getActivity().getApplicationContext(), WatchTvActivity.class);//WatchTvActivity 是一个完整的窗体
Bundle bundle = new Bundle();
bundle.putInt("id", id);//传递id索引
intent.putExtras(bundle);
return null;
}
protected void onPostExecute(Void aVoid) {//检查
super.onPostExecute(aVoid);//这是个异步处理
if (dialog != null) dialog.dismiss();
startActivity(intent);//打开
}
//--------获取
Bundle bundle = getIntent().getExtras();
id = bundle.getInt("id");
点击按钮打开一个新的窗口 关键词(Intent, setData , putExtra , startActivity |Bundle)的更多相关文章
- vue中使用router打开一个新的窗口
一个单页应用打开一个新的窗口不是很好控制,比如权限的处理,因为原先的页面不会自动刷新,方法很简单: let routeData = this.$router.resolve({ name: " ...
- 关于JavaScript点击按钮打开多个页面被浏览器以广告嫌疑拦截怎么解决
JS点击按钮打开新的标签页,工作中遇到需要点击按钮打开一个或多个,需要用到window.open() 工作中我们可能需要打开多个,看以下代码: var data = [{ "id" ...
- JS 点击元素发ajax请求 打开一个新窗口
JS 点击元素发ajax请求 打开一个新窗口 经常在项目中会碰到这样的需求,点击某个元素后,需要发ajax请求,请求成功以后,开发需要把链接传给前端(或者说请求成功后打开新窗口),前端需要通过新窗口打 ...
- Window.open 实现导航与打开窗口,导航到一个特定链接地址,也可以打开一个新的浏览器窗体
语法 window.open(strUrl,strWindowName,strWindowFeatures ,replace) strUrl: 打开资源的地址 strWindowName: 表示窗体名 ...
- 使用javascript打开一个新页而不被浏览器屏蔽
使用javascript打开一个新页面可以有几种方式,但各有利弊,以下做下分析 1.window.open(url) 这是新手最常用的方法,好处是简单易用,坏处,很简单,会被很多浏览器拦截而导致功能失 ...
- Android课程---Oracle VM VirtualBox出现不能为虚拟机打开一个新任务
因工作需要在Win7下增添了Win7虚拟系统,随着VirtualBox 4.326的版本更新,用户们也开始升级.一用户在升级后发现原来创建的虚拟机无法打开,提示信息为:不能为虚拟电脑win7打开一个新 ...
- VirtualBox不能为虚拟电脑 Ubuntu 打开一个新任务
今天在用Vbox中的Ubuntu系统准备测试Python代码时,Vbox报了一个错误:"不能为虚拟电脑 Ubuntu 打开一个新任务".因为之前用的时候还好好的,也不知道是不是最近 ...
- VirtualBox不能为虚拟电脑打开一个新任务——The VirtualBox kernel modules do not match this version of VirtualBox
本文由荒原之梦原创,原文链接:http://zhaokaifeng.com/?p=608 一.问题产生的环境 物理机操作系统:Ubuntu 17.10 (Ubuntu版本查看命令: cat /etc/ ...
- VirtualBox报错:不能为虚拟电脑XXX打开一个新任务
报错产生的背景 今天在这里下载了一个用于VirtualBox的Kali Linux虚拟机文件(使用VirtualBox可以直接打开使用,不用执行安装过程).但是将该文件导入到VirtualBox中之后 ...
随机推荐
- 关于cout输出精度问题
#include <iostream.h> #include <iomanip.h> void main(void) { cout.setf(ios::fixed); cout ...
- Event Handling Guide for iOS--(三)---Event Delivery: The Responder Chain
Event Delivery: The Responder Chain 事件传递:响应链 When you design your app, it’s likely that you want to ...
- Vue-i18n实现语言切换
方法1 Vue — i18n 国际化 全局配置 安 装 1.直接引入js文件 <script src="https://unpkg.com/vue/dist/vue.js"& ...
- HDU5145:5145 ( NPY and girls ) (莫队算法+排列组合+逆元)
传送门 题意 给出n个数,m次访问,每次询问[L,R]的数有多少种排列 分析 \(n,m<=30000\),我们采用莫队算法,关键在于区间如何\(O(1)\)转移,由排列组合知识得到,如果加入一 ...
- Codeforces510B【dfs】
判断一个图里是否有一个自环: 50*50 标记起点,然后暴搜? #include <bits/stdc++.h> #include<algorithm> using names ...
- POJ3186【区间DP】
题意: 每次只能取两端,然后第 i 次取要val[ i ]*i,求一个最大值 一切都是错觉[读者省略此段] 这道题目一开始想的就是记忆化搜索,然后太天真了?好像是,一开始用一维dp[ i ]直接代表一 ...
- UWP 页面跳转传值
如果涉及到页面跳转,一般用Frame这个控件来管理不同的页面. <Grid Name="RootGrid"> <Frame Name="RootFram ...
- JavaScript-页面打印正方形,各种三角形与菱形
一. 正方形 a) 在第一个for循环中控制,一共输出几行.依靠的是,每次输出一行,就会在后面输出一个换行符<br>; b) 在第二个for循环中控制每行输出几个五角星.这样的 ...
- magento 开启 3D secure credit card validation
因为国外盗刷严重,于是得开启验证. 首先可以去 https://developer.cardinalcommerce.com/try-it-now.shtml.这上面有测试账号,截图如下:
- h5-35-ajax轮询实现推送效果
data.txt { "number1":1200, } index.html <!DOCTYPE html> <html> <head> &l ...