我们要绑定service的时候要实现ServiceConnection这个接口;这个接口有两个方法@Override public void onServiceConnected(ComponentName arg0, IBinder service) {// 服务被绑定成功后调用}@Overrid...
分类:
其他好文 时间:
2015-10-19 00:31:16
阅读次数:
152
清理内存clear:package com.android.cleanprocesstool;import android.content.BroadcastReceiver;import android.content.ComponentName;import android.content.Co...
分类:
其他好文 时间:
2015-09-18 13:28:21
阅读次数:
274
在学习Android的过程中,Intent是我们最常用Android用于进程内或进程间通信的机制,其底层的通信是以Binder机制实现的,在物理层则是通过共享内存的方式实现的。 Intent主要用于2种情景下:(1)发起意图 (2)广播 它的属性有:ComponentName,action,da.....
分类:
其他好文 时间:
2015-09-06 12:50:43
阅读次数:
173
项目里要用到一个网络状态判断的功能,想到了QQ的网络状态判断和设置功能,决定模仿一下。实现起来也很是容易,界面较丑,还望原谅。1.MainActivity.java:package com.example.networktest;
import android.app.Activity;
import android.content.ComponentName;
import android.c...
分类:
移动开发 时间:
2015-08-17 14:09:45
阅读次数:
255
1、改为自己的launcher
ComponentName component = new ComponentName(
context.getPackageName(), MainActivity.class.getName());
ComponentName[] components = new ComponentName[] {
new ComponentName("com.andr...
分类:
移动开发 时间:
2015-07-20 16:38:25
阅读次数:
156
在Intent中可以直接使用Intent.setClass()也可以使用组件Component简单的使用方式如下Java代码packagecom.huawei;importandroid.app.Activity;importandroid.content.ComponentName;importa...
分类:
其他好文 时间:
2015-07-17 18:40:10
阅读次数:
140
ComponentName是用来打开其它应用程序中的Activity或服务的。使用方法:Intent i=new Intent();i.setComponent(new ComponentName(String packageName,String activityName ));startActi...
分类:
其他好文 时间:
2015-06-23 19:34:35
阅读次数:
106
在之前,一般我们是通过下面的方式,来调用系统设置(时间设置、网络设置等等):1 Intent intent = new Intent();2 ComponentName cn = new ComponentName("com.android.settings",3 "com.andr...
分类:
移动开发 时间:
2015-06-16 06:37:32
阅读次数:
132
ComponentName是用来打开其它应用程序中的Activity或服务的。使用方法:Intent i=new Intent();i.setComponent(new ComponentName(String packageName,String activityName ));startActi...
分类:
其他好文 时间:
2015-06-08 11:36:11
阅读次数:
85
MainActivity.java如下packagecom.example.bindservice;importcom.example.bindservice.BindService.MyBinder;importandroid.os.Bundle;importandroid.os.IBinder;importandroid.app.Activity;importandroid.content.ComponentName;importandroid.content.Context;importandroi..
分类:
其他好文 时间:
2015-06-06 15:07:41
阅读次数:
121