`
xinanadu
  • 浏览: 227354 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论
文章列表
在BroadcastReceiver中接收到广播之后,有时会进行一些耗时的操作。大家一般有两种写法: 1)在当前BroadcastReceiver中另起线程操作 2)由当前BroadcastReceiver启动新的Service,在新的Service中操作   其实,第一种方法并不推荐。因为大家都知道,安卓在内存不足或其他资源不够的情况下会作清理。而BroadcastReceiver在onReceive()调用后,就只剩下一个线程在跑了,没有service的级别高!   在http://developer.android.com/guide/components/processe ...
Activity.runOnUiThread(Runnable) View.post(Runnable) View.postDelayed(Runnable, long) 示例:  publicvoid onClick(View v){     newThread(newRunnable
最近在做一个项目,需要只显示手机联系人,不显示SIM卡联系人。但查了半天资料,只能做到获取全部联系人、包括手机、SIM卡联系人,或者只获取SIM卡联系人。在网上这个问题也有些人在问,中国的、外国人都在问。但没有解决方案。有些手机方案商会在数据表里设置一个is_sim或者indicator_phone_or_sim_contacts的字段,但不通用。   后来发现,安卓的联系人数据库设计,并没有区分特地手机联系人和SIM卡联系人。而是有个账户的概念! Contacts.Entity.ACCOUNT_TYPE, Contacts.Entity.ACCOUNT_NAME这两个字段分别是账户的 ...
1,Checkbox 设置完button属性后,文本和button之前在2.3以下没有padding,在4.0设备中确相当大的padding。当然可以通过设置paddingLeft属性调整这个间距,但是这样4.0没问题,2.3问题有出来了。 那怎么样来设置Checkbox的自定义选框且不产生padding的问题呢? 那就是不要使用button属性(button=”@null”),通过drawableLeft 来设置自定一选框,并且把backgroud设置为@null, 选框和文字的padding可以用过drawablePadding属性来进行设置。这样就不会出现在不同OS下,padding ...
项目中突然想用Content Provider实现跨应用操作数据的功能,虽然后来没有利用Content Provider来实现。但还是写了个简单demo程序,熟悉一下Content Provider的开发。这篇文章只是简单记录下,下一篇文章具体解释需要注意的问题   两个项目,一个继承Content Provider将数据库的CRUD操作显露给其他应用,另一个项目,则是进行CRUD操作。很简单的功能。   ----------------------------------------------------------- 项目1: 首先创建 DatabaseHelper p ...
启动其他应用的activity,只需要两个东西。该应用的包名,被启动的activity的class全名。两个都是String类型。参考android文档: Intent android.content.Intent.setClassName(String packageName, String className)  还需一点:被启动的activity需设置标签: android:exported="true"   这样就够了!
在一次开发中,为了利用广播broadcast实现跨应用通讯,写了2个测试应用,BroadcastCrossApps1和BroadcastCrossApps2。   在BroadcastCrossApps1的MainActivity有个按钮,按下事件发送广播至BroadcastCrossApps2的TestReceiver,该TestReceiver启动该应用(即BroadcastCrossApps2)中MainActivity。同样,BroadcastCrossApps2的MainActivity也有发送给BroadcastCrossApps1的TestReceiver的广播。   简 ...
ICCID:Integrate circuit card identity 集成电路卡识别码(固化在手机SIM卡中) ICCID为IC卡的唯一识别号码,共有20位数字组成。 IMSI: International Mobile SubscriberIdentification Number 国际移动用户识别码,是区别移动用户的标志,储存在S ...
参考:     来自陈显的博客 http://www.cnblogs.com/chenxian/     下面是响铃之后到接听的流程     首先,加入是通过Touch接听     通过Touch,首先触发的是InCallTouchUi类,当移到接听位置后,由于InCallScreen实现了OnTouchListener,     所以将会出发InCallScreen的handleOnscreenButtonClick事件。里面将会执行internalAnswerCall()方法。     该方法又会调用PhoneUtils类的answerCall()方法,该方法里首先让Ri ...
The method show(FragmentManager, String) in the type DialogFragment is not applicable for the arguments (FragmentManager, String)   public static class MyDialogFragment extends DialogFragment { AlertDialog dialog = null; @Override public Dialog onCreateDialog(Bundle savedInstanceSt ...
跨应用发送和接收广播,与同应用下的情况差不多,只需要添加一个权限,以及配置一下receiver的android:process属性即可     发送广播的应用中:   Intent intent = new Intent("info.zhegui.receiver.interprocess"); sendBroadcast(intent);  注意要在manifest.xml添加接收广播的权限,这个权限是receiver自定义的 <uses-permission android:name="info.zhegui.receiver.REC ...
转自http://iriverman.iteye.com/blog/807965   GPS是否开启 LocationManager locationManager = (LocationManager)getContext(). getSystemService(Context.LOCATION_SERVICE); return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); 进入GPS设置页面 Intent intent = new Intent(); i ...

android自带图标

安卓自带的图标,可以直接拿来用的,分享下   http://docs.since2006.com/android/2.1-drawables.php
/** *打电话 * * @param tel * 电话号码 */ protected void call(String tel) { // 只进入拨号界面,不拨打 Uri uri = Uri.parse("tel:" + string); Intent intent = new Intent(Intent.ACTION_DIAL, uri); startActivity(intent); //直接拨打 Log.d(TAG, "call:" + ...
移除某个元素,用 ((ViewManager) (view).getParent()) .removeView(view);  其中view是需要移除的元素
Global site tag (gtag.js) - Google Analytics