Firefox os activity简析
来源:互联网 发布:下载淘宝注册 编辑:程序博客网 时间:2024/05/20 07:52
Firefox os activity简析
从android中我们可以看到activity 是android 中展示在用户面前的操作载体,firefox也一样拥有相同类似的功能,接下来让我们看看activity在firefox的意义及用法,在firefox os 手机应用开发时我们需要不同的界面跳转时也一样需要activity进行相互交互,不像安卓那样用java编写activity,firefox os 主要用html做指引javascript做控制,额,扯到一边去了,还是看怎么用吧。
首先和android一样需要在manifest中对activity做声明,android的是manifest.xml而firefox os 则是mabifest.webapp
{
// Other App Manifest related stuff
// Activity registration
"activities": {
// The name of the activity to handle (here "pick")
"pick": {
"href": "./pick.html",
"disposition": "inline",
"filters": {
"type": ["image/*","image/jpeg","image/png"]
},
"returnValue": true
}
}
}
其次是启动要跳转到的activity 即 Starting an activityvar activity = new MozActivity({
// Ask for the "pick" activity
name: "pick",
// Provide de data required by the filters of the activity
data: {
type: "image/jpeg"
}
});
activity.onsuccess = function() {
var picture = this.result;
console.log("A picture has been retrieve");
};
activity.onerror = function() {
console.log(this.error);
};
最后是你所启动的activity要执行什么样的操作
navigator.mozSetMessageHandler('activity', function(activityRequest) {
var option = activityRequest.source;
if (option.name === "pick") {
// Do something to handle the activity
...
// Send back the result
if (picture) {
activityRequest.postResult(picture);
} else {
activityRequest.postError("Unable to provide a picture");
}
}
});
0 0
- Firefox os activity简析
- Firefox os activity简析
- Firefox OS
- Firefox os
- Firefox os
- firefox os
- Firefox OS编译
- Firefox os初体验
- 关注firefox os
- firefox os架构
- 为什么选择firefox os
- firefox os 框架解析
- Firefox OS 源码泄露!!!
- PC 运行 Firefox OS
- Firefox os Action menus
- firefox os 重要概念
- Firefox OS简介
- Firefox OS简介
- "我不比健全人差" 盲人大学生成首位视障程序员
- 百度是如何给每个人免费提供2TB存储空间的?
- launchMode 总结
- 循环缓冲类
- UIPickerView
- Firefox os activity简析
- curses.h库学习笔记
- 状态压缩dp入门 第一题 POJ 3254 Corn Fields
- TextView里直接显示图片的方法
- 在 Xcode 5 的 Storyboard 中使用 UITableView
- <html:errors/> 一个jsp里两个或多个<html:errors/> 分别显示错误信息
- 《Java并发变成实践》读书笔记---第一章 简介
- 外媒:90%中国程序员和记者自视屌丝 公务员比例低
- Match One of Two Alternatives Based on a Condition (基于条件匹配多个选择中的一个)