Android
火星有雨
这个作者很懒,什么都没留下…
展开
-
通过蓝牙发送文件到指定设备
/** the intent that is used for initiating a handover transfer */ static final String ACTION_HANDOVER_SEND = "android.nfc.handover.intent.action.HANDOVER_SEND"; /** * 通过蓝牙发送文件 */ private void sendFile(Uri uri) { super.gr...原创 2022-05-31 17:25:00 · 398 阅读 · 0 评论 -
Android 天气预报程序
1:获取地理位置LocationManager locationManager;String serviceName = Context.LOCATION_SERVICE;locationManager = (LocationManager) getSystemService(serviceName);Criteria criteria = new Criteria();criteria.setAccuracy(Criteria.ACCURACY_FINE);criteria.setAltitudeRequ原创 2011-03-16 12:27:00 · 732 阅读 · 0 评论 -
PendingIntent在AppWidget程序中的应用
<br />1、绑定某一个Widget:<br />updateViews.setOnClickPendingIntent(R.id.next_button, pendingIntent);<br />这里的updateViews是AppWidget的RemoteViews对象<br />2、通过PendingIntent启动一个Activity:<br />格式如下:<br /><br />Intent intent3 = new Intent(context, Activity.class);<br /原创 2011-03-16 12:37:00 · 362 阅读 · 0 评论 -
工作笔记:滥用static标记引发的内存溢出
前天同事问了我一个问题,说替换Android程序中的图片资源会不会引起程序错误。至少我是没有碰到过这种问题。在res/drawable目录下无论是使用jpg、gif还是png格式,都没引发过任何错误。 晚上的时候,同事又将运行错误时的log文本发给我。log上描述的是程序运行到某个draw方法时发生了异常,程序无法分配到足够大的内存。我马上问同事,他替换的图片到底有多大。他告诉我说,是20k。20k这样大小的图片,以前做S40的时候,感觉已经是很奢侈的大小了,但是在 Android平台上,这样的大小算原创 2011-03-20 10:07:00 · 1857 阅读 · 2 评论