
Android
文章平均质量分 64
geek-wk
业精于勤,荒于嬉;
行成于思,毁于随;
---致zj;
展开
-
Android获得当前正在运行的Activity及相关信息
本文实例讲述了android获取当前运行Activity名字的方法,可以避免即时聊天再出现通知的情况。分享给大家供大家参考。具体方法如下:最近在做IM时需要知道当前Activity是哪一个Activity.自己整理一下两种方法第一种:要方便一点(Service中无法使用)复制代码 代码如下:private String getRunningActivityName() {原创 2015-10-02 13:59:01 · 18005 阅读 · 0 评论 -
Android 应用图标
1.程序启动图标:1.小屏(Low density screen):ldpi (120 dpi):36x36px;2.中屏(Medium density screen):mdpi (160 dpi):48x48px;3.大屏(High density screen):hdpi (240 dpi):72x72px;4.特大屏:xhdpi (320 dpi):96x96px;2.底原创 2016-01-21 15:13:43 · 744 阅读 · 0 评论 -
Android Bluetooth4.0(BLE是Bluetooth Low Energy的简称) 官方API
个人经验分享:1.官方Android Bluetooth4.0 API主要组成部分:3个Activity做界面展示,1个Service负责蓝牙后台数据传输;分享demo里已实现基本数据的Read+Write,剩下的工作要靠自己去领悟了;加油,俺就是这么白手起家的;1.附上demo实例,助初学者快速上手入门:http://download.youkuaiyun.com/detail/wk10636459原创 2015-09-14 22:17:11 · 2287 阅读 · 2 评论 -
Intent
1.Activity里启动其它的Activity:Intent intent,intent0,intent1;//initialize LoginActivityintent = new Intent(this,LoginActivity.class);intent0 = new Intent(MainActivity.this,LoginActivity.class);int原创 2015-11-09 18:16:03 · 440 阅读 · 0 评论 -
Service was originally bound here
1.错误原因:在Activity运行了bindService()开启Service(全名:boolean android.content.ContextWrapper.bindService(Intent service,ServiceConnection conn, int flags));但在destory()里没有调用unbindService ()关闭Service(voi原创 2015-11-20 11:24:11 · 6015 阅读 · 0 评论 -
Service not registered
1.错误原因:在Activity中没有运行bindService(Intent service, ServiceConnection conn, intflags);却在destory()里执行了unbindService(ServiceConnection conn);因此会抛出Servicenot registered异常;1.服务未注册,看到其他博客上是用this.get原创 2015-11-20 17:00:29 · 13492 阅读 · 0 评论 -
android.os.DeadObjectException
1.错误原因:1.deadObjectException异常,说明应用的service已经停止;要么是从操作系统中丧生,要么从应用程序中终止;也就是在application标签里面添加了一句android:hardwareAccelerated="false"(禁用硬件加速);于是问题就解决了,开始的时候我是加到了对应的activity标签里面,结果发现第1次可以运行完美等1段时间又会原创 2015-11-25 13:56:52 · 39033 阅读 · 7 评论 -
Service
1.Service启动方式:1.通过startService中的intent传递参数,每次调用startService,都会触发Service的onStartCommand方法;在onStartCommand里面接收;Service的生命周期方法比Activity少一些,只有onCreate,onStart, onDestroy我们有2种方式启动Service,他们对Service生命原创 2015-11-12 09:46:45 · 466 阅读 · 0 评论 -
android+string.xml;
1.条件就是在此之前string.xml要为某id事先预留变量,代码能够修改它,例如说:今年是%1$d年JAVA代码中可用:String a = getResources().getString(R.string.a);String b = String.format(a, 2011);将%1$d替换为20111.My实际应用:可视化界面修改APP名字;简单解释%1原创 2015-11-09 16:17:57 · 466 阅读 · 0 评论 -
Android+Dialog;
1.dialog.dismiss():取消对话框;Dismiss this dialog, removing it from the screen.原创 2015-11-05 18:29:23 · 429 阅读 · 0 评论 -
Broadcast
1.实践经验(本人)://before sendBroadcast must new Intent();Intent intent = new Intent();//before sendBroadcast must setAction();intent.setAction(ACTION_DEVICE_STATUS); intent.putExtra(DeviceService原创 2015-11-25 18:44:51 · 741 阅读 · 0 评论