2012年3月28日学习记录

一、设计模式


1,桥接模式:在于突出聚集和合成的关系。类似于有手机的硬件、软件之分的时候,可以通过是用桥接模式,可以很好的处理硬件和软件的使用问题,而需要注意的是当我们写面向对象的程序的时候,需要判断继承的关系是不是(IS-A)的关系,如果不是就尽量不要是用继承的关系,可以考虑是用聚集和组成关系。

二、Android中的category

1.description:为过滤器增加一个说明,类似一个附加信息
    Adds a category name to an intent filter. See Intents and Intent Filters for details on intent filters and the role of category specifications within a filter.


三、Intent的小结:

1.action代表android客户端所需要进行的操作(可以是调用系统的调用或者是自己定义的action)
2.category是针对action的一个修饰其中需要在( Intent Filters)中
3.data是传递action动作所需要的数据(比如调用网页则需要告诉网址是多少)

实现:
1.打电话:
data = "tel:13808040469";
uri = Uri.parse(data);
intent.setAction(Intent.ACTION_CALL);
intent.setData(uri);
startActivity(intent);
2.打电话:
// intent.setAction(Intent.ACTION_GET_CONTENT);
// intent.setType("vnd.android.cursor.item/phone");
3,回到主界面:
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent)
4,在android的配置文件中进行书写
  <activity 
            android:name="MyActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
<data android:scheme="http" android:path="www.google.com">
            </intent-filter>
        </activity>


四、service学习

1.本地调用
a.了解service的使用地方:
自己了解到的使用点:action的操作

b.service的生命周期

c.service的调用方法:
startservice(intent)方法
绑定方法:bindService(intent, connection, BIND_AUTO_CREATE);
ServiceConnection是处理开始连接和关闭链接的操作


2.远程调用:RPC(还需要深入学习)
a.RPC的使用地方:



 

你可能感兴趣的:(设计模式,android,service,Scheme,action,电话)