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

哪家做网站公司好/竞价推广怎样管理

哪家做网站公司好,竞价推广怎样管理,网站建设的关键,重庆建网站诚选快忻科技悉心Intent Filter是android里非常有特色的一个概念。他的用户体验和windows下的文件管理器的弹出菜单里的“打开方式”非常相似。在windows中,当用户选择了打开方式菜单后,系统让用户选择应用来打开所选择的文件。而在android中的文件已经被uri资源代替了。…

Intent Filter是android里非常有特色的一个概念。他的用户体验和windows下的文件管理器的弹出菜单里的“打开方式”非常相似。在windows中,当用户选择了打开方式菜单后,系统让用户选择应用来打开所选择的文件。而在android中的文件已经被uri资源代替了。

Intent Filter在android中的应用非常普遍,尤其在资源共享中。例如,当用户选择了一个图片,选择了共享,我们常常会发现一个选择列表。这个选择列表是动态生成的,不是一成不变的。假如你新安装了facebook应用,那么facebook就会出现在这个列表里面。从这个例子可以发现,intent filter的设计使得android系统显得更加灵活了。

要实现一个Intent Filter, 我们要在AndroidManifest.xml中加入必要的设置,以通知系统某个activity都能够处理什么类型的URI资源,然后要在activity的onCreate中加入必要的代码以处理系统传递过来rui资源。

 

一个Service、 Activity 或者 Brodcast Reciever 的Intent Filter , 的事件过滤器, 我们用着大家都很了然的说法来描述之吧, 实际上描述了拥有这些过滤器组建在系统中所具有能力。

Filter 的创建都是通过 manifest.xml 文件, 但是对于 Broadcast Reciever 用 Context.registerReceiver() 来创建。Filter 可以包含三种类型的过滤条件 <action> <category> <data>

一个Intent 是否能够通过一个过滤器到达对应的处理器取决于, Intent 所包含的 所有Categroy 是够都在 过滤器中的catergory 列表里出现。 换句话说, 没有 catergory字段的Inteng 可以通过任何过滤器, 而一个过滤器, 必须至少要有一个可以通过的限定,Category 或者 Action。 对于Action 也一样, 能够通过Filter 的Itent的 Action 必须被列与 Category中。同样, 没有Action 的Intent 也可以通过所有的Filter。

对于 <data> 过滤条件稍微复杂点,   但是总的原则还是, 只有Intent 能够通过 Filter, 那么Intent 中的信息,必须出现在Filter中。 <data> 需要指定 scheme://host:port/path , 条件顺序的优先级随着范围缩小而降低,相当于,看作目录,在子目录下匹配。 比如, Filter指定了 scheme, 那么所有具有这个 scheme 的 Intent 都能通过,这个Filter, 类似的通配符的情况也是允许的。

这里翻译文档中的四个例子情况:

a.如果没有定义URI 和数据类型, 则,该Intent只能通过没有定义URI和 数据类型的 过滤器。

b.只定义了URI的 Intent 只能通过只定义了 URI 的过滤器。

c.只定义了 数据类型的 Intent 也只能通过只定义了 数据类型的过滤器。

d. 如果一个Intent同事定义了URI和 数据类型, 或者数据类型可以由URI推定, 则只有具备了对应的数据类型,或者 content: 或者 file: 类型,并且没有定义URI的过滤器。(这种情况, 你自己代码一下就明白了, 在写下去,我也不鸟鸟了。)

如果通向Activities 的Intent 引起了多个响应, 就会出现需要用户指定的提示, 或者是异常。

 

差不多就是这样的情况了, android 的这种机制非常适合移动设备之间的应用相互调用, 以便在更大的粒度上达成复用。很强大。

 

/Chapter06_Intent_Filter/src/com/amaker/ch06/app/MainActivity.java

 

ContractedBlock.gifExpandedBlockStart.gif代码
package com.amaker.ch06.app;

import com.amaker.ch06.app.R;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
/**
*
* Intent Filter 测试
*/
public class MainActivity extends Activity {
// 声明Button
private Button btn;
private static final String ACTION1 = "com.amaker.ch06.app.TEST_ACTION1";
private static final String ACTION2 = "com.amaker.ch06.app.TEST_ACTION2";
private static final String ACTION3 = "com.amaker.ch06.app.TEST_ACTION3";

private static final String CATEGORY1 = "com.amaker.ch06.app.CATEGORY1";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 设置内容布局
setContentView(R.layout.main);
//实例化按钮
btn = (Button)findViewById(R.id.Button01);

String a
= Intent.ACTION_VIEW;
// 添加单击监听器
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Intent intent
= new Intent();
//intent.setAction(ACTION1);
//Uri data = Uri.parse("content://com.amaker.ch07.app/abc");
//intent.setData(data);

intent.addCategory(CATEGORY1);

intent.setAction(
"android.intent.action.VIEW");
intent.setData(Uri.parse(
"http://www.google.com"));

startActivity(intent);
}
});
}
}

 

/Chapter06_Intent_Filter/src/com/amaker/ch06/app/TestActivity.java

 

ContractedBlock.gifExpandedBlockStart.gif代码
package com.amaker.ch06.app;

import com.amaker.ch06.app.R;

import android.app.Activity;
import android.os.Bundle;
/**
* 测试Intent Filter
*/
public class TestActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main1);
}
}

 

 

/Chapter06_Intent_Filter/res/layout/main.xml

 

ContractedBlock.gifExpandedBlockStart.gif代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation
="vertical"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent"
>
<Button
android:text="测试Intent Filter"
android:id
="@+id/Button01"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"></Button>
</LinearLayout>

 

/Chapter06_Intent_Filter/res/layout/main1.xml

 

ContractedBlock.gifExpandedBlockStart.gif代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation
="vertical"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent"
>

<TextView
android:text="测试Intent Filter"
android:id
="@+id/TextView01"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"></TextView>

</LinearLayout>

 

/Chapter06_Intent_Filter/AndroidManifest.xml

 

ContractedBlock.gifExpandedBlockStart.gif代码
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package
="com.amaker.ch06.app"
android:versionCode
="1"
android:versionName
="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label
="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name="TestActivity" >
<intent-filter>
<action android:name="com.amaker.ch06.app.TEST_ACTION1"/>
<action android:name="com.amaker.ch06.app.TEST_ACTION2"/>
<action android:name="com.amaker.ch06.app.TEST_ACTION3"/>

<action android:name="android.intent.action.VIEW"/>


<data android:scheme="content" android:path="com.amaker.ch07.app/abc"/>
<data android:scheme="http" android:path="www.google.com" />

<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="com.amaker.ch07.app.CATEGORY1"/>

</intent-filter>
</activity>

</application>
<uses-sdk android:minSdkVersion="3" />

</manifest>

 

转载于:https://www.cnblogs.com/linzheng/archive/2011/01/20/1939742.html

http://www.jmfq.cn/news/5086531.html

相关文章:

  • 电子商务网站开发相关技术/seo搜索引擎优化师
  • 中国最新消息军事方面的/seo零基础入门到精通200讲
  • 招标网招标信息/沈阳seo公司
  • mysql 网站空间/2023重大新闻事件10条
  • 新公司做网站有效果吗/免费网站流量统计工具
  • 电子商务网站开发实/google关键词排名
  • 如何做让公众都知道的网站/如何做好网络营销
  • 投诉网站怎么做/软文广告经典案例分析
  • 做网站第一次见客户/百度非企渠道开户
  • 手把手教你做网站视频/指数函数图像及性质
  • wordpress整站密码访问/谷歌商店下载
  • 网站的折线图怎么做/优化大师下载电脑版
  • 哪个网站可以做立体字的模板/seo推广外包
  • wordpress的前端怎么写/如何优化关键词排名到首页
  • 子网站怎么做/营销说白了就是干什么的
  • 网站首页滚动图片用dw怎么做/百度推广开户费用多少
  • 外包一个企业网站多少钱/武汉seo搜索引擎优化
  • 如何备份wordpress网站/互动营销案例
  • 兰州网站制作培训班/宁波网站优化公司价格
  • 百度做公司网站需要多少钱/学网络营销有用吗
  • 济宁市兖州区城市建设局网站/网络营销网站有哪些
  • 西安市招聘网最新招聘信息/网络推广优化招聘
  • 郑州网站开发公/百度网首页登录入口
  • 长沙口碑好网站建设/游戏推广文案
  • 微信微网站是什么格式的/软文推广案例
  • 山东卓商网站建设公司/网站内容优化怎么去优化呢
  • 政府网站集约化建设建议/相似图片在线查找
  • 怎么做网站赚钱吗/什么平台打广告比较好免费的
  • 深圳网站如何制作/百度搜索推广的定义
  • 阿里巴巴怎么做公司网站/官网建站多少钱