随笔分类 -  Android

摘要:如何按返回键退出程序一、tabhost 中 此行代码public boolean onKeyDown(int keyCode, KeyEvent event)无法监听到 返回键;需重写public boolean dispatchKeyEvent(KeyEvent event)二、通过dispatchKeyEvent 监听到的 back返回键,有up 和 down 状态(按下和弹起),会导致 onclik 事件执行两次,如弹出对话框两次,而导致,如果在一个对话框事件后finish掉一个activity,又再次弹出对话框而产生异常:logcat05-04 06:11:54.184: E/Wind 阅读全文
posted @ 2012-05-04 10:57 antoniohu 阅读(323) 评论(0) 推荐(0)
摘要:Service与BroadcastReceiver> abstract IBinder onBind(intent) //必须实现的方法> void onCreate()> void onDestroy()> void onStartCommand(intent,flags,staratId > boolean onUnbind(intent)Context> startService(service)#初建时调用onCreate(),多次启动回调onStart()> bindService(service,conn,flags)ServiceConn 阅读全文
posted @ 2012-03-31 21:03 antoniohu 阅读(585) 评论(0) 推荐(0)
摘要:ContentProvider注册AndroidManifest.xml> <provider android:name=".DictProvider" android:authorities="org.crazyit.providers.dictprovider"/>> boolean onCreate()> Uri insert(uri,values)> int delete(uri,selection,selectionArgs)> int update(uri,values,selection,selec 阅读全文
posted @ 2012-03-31 21:02 antoniohu 阅读(234) 评论(0) 推荐(0)
摘要:数据存储和IO"SharedPreferences 与 Editor"SharedPreferences> boolean contains(String key)> abstract Map<String,?> getAll()> getXxx(String key,xxx defValue)> preferences = getSharePreferences(String name,int mode)mode:> Context.MODE_PRIVATE> Context.MODE_WORLD_READABLE> 阅读全文
posted @ 2012-03-29 14:46 antoniohu 阅读(179) 评论(0) 推荐(0)
摘要:图形与图像处理Bitmap代表一张位图BitmapDrawable里封装一个BitmapBitmapDrawable drawable = new BitmapDrawable(bitmap)Bitmap bitmap = drawable.getBitmap();//获取bitmap对象创建新Bitmap对象:> createBitmap(source,x,y,width,height)> createScaledBitmap(src,dstWidth,dstHeight,filter)> createBitmap(width,height,config)> crea 阅读全文
posted @ 2012-03-28 15:29 antoniohu 阅读(227) 评论(0) 推荐(0)