2012年3月19日
摘要: 获取最佳的LocationProvider,这个最佳是根据条件相对而言滴 //现在先来取得电子设备中都提供了哪些LocationProvider List<String> providers = locationManager.getAllProvider(); for(Iterator iterator = providers.iterator ;iterator.hasNext()){ String s = (String)iterator.next(); } //根据条件得到最佳LocationProvider 需要通过Criteri... 阅读全文
posted @ 2012-03-19 10:08 lee0oo0 阅读(376) 评论(0) 推荐(0) 编辑
  2012年3月18日
摘要: User Location主要用于获取用户的位置和追踪用户的移动 关键API: Location Manager用于管理Android的用户定位服务;Location Provider提供多种定位方式供开发者使用 定位方式的分类: 1. 使用GPS卫星进行定位,需要在AndroidManifest当中声名权限android.permission.ACCESS_FINE_LOCATION 2. NETWORK定位,使用信号接收塔和Wi-Fi介入点进行定位,需要在AndroidManifest当中声名权限android.permission.ACCESS_FI... 阅读全文
posted @ 2012-03-18 22:06 lee0oo0 阅读(425) 评论(0) 推荐(0) 编辑
摘要: 1、 因为在一般程况下数据库的都是一个实例访问既可以,因此这个时候可以把类设计成单例模式,例: public class DBUtil { //设计构造函数为私有,不能被其他类创建实例,同时也不能被继承 privateDBUtil(){} private staticDBUtil instance = null; //提供一个外部创建的方法 public synchronized static DBUtil getDBUtilInstance(){ if(instance == null){ ins... 阅读全文
posted @ 2012-03-18 01:21 lee0oo0 阅读(446) 评论(0) 推荐(0) 编辑
  2012年3月16日
摘要: 使用Get方法提交: 其他步骤与上一节的操作相符,只是在传送地址的时候发送参数的格式如下: //Sname和Sage是实际的数据 name和age则是例如是输入框中的名字 url = "服务器的地址"+ "?" + "name=" + Sname + "&age=" + Sage;使用Post方法提交: //使用NameValuePair类来保存键值对,使用NameValuePair类是因为下面需要的那个类的参数要求 NameValuePairNameValuePair1 = newNameValuePai 阅读全文
posted @ 2012-03-16 16:50 lee0oo0 阅读(7373) 评论(0) 推荐(0) 编辑
摘要: //生成一个请求对象 HttpGet httpGet = new HttpGet("http://www.baidu.com"); //生成一个http客户端对象 HttpClient httpClient = new DefaultHttpClient(); //客户端向服务器发送请求,返回一个响应对象 HttpResponse httpResponse=httpClient.execute(httpGet); //根据响应得到实体内容 HttpEntity entity =httpResponse.getEntity(); //使用I... 阅读全文
posted @ 2012-03-16 15:49 lee0oo0 阅读(1006) 评论(0) 推荐(0) 编辑
摘要: 系统打电话界面:Intent intent = new Intent();//系统默认的action,用来打开默认的电话界面intent.setAction(Intent.ACTION_CALL);//需要拨打的号码intent.setData(Uri.parse("tel:"+i)); callPhoneAndSendMessage.this.startActivity(intent);系统发短信界面:Intent intent = new Intent();//系统默认的action,用来打开默认的短信界面 intent.setAction(Intent.ACTION_ 阅读全文
posted @ 2012-03-16 11:20 lee0oo0 阅读(13700) 评论(0) 推荐(1) 编辑
  2012年3月14日
摘要: 1. 接受来自App Widget的广播 //Androidmanifest中的文件旨要,只要有个一action符合就会调用继承AppWidgetProvider的类: <receiver android:name="继承AppWidgetProvider的类"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATA"/> </intent-filter> <intent-filter> & 阅读全文
posted @ 2012-03-14 15:29 lee0oo0 阅读(309) 评论(0) 推荐(0) 编辑
摘要: ContentValues values = new ContentValues();//首先向RawContacts.CONTENT_URI执行一个空值插入,目的是获取系统返回的rawContactId Uri rawContactUri = context.getContentResolver().insert(RawContacts.CONTENT_URI, values); long rawContactId = ContentUris.parseId(rawContactUri); values.clear(); values.put(Data.RAW_CONTACT_ID, raw 阅读全文
posted @ 2012-03-14 11:59 lee0oo0 阅读(385) 评论(0) 推荐(0) 编辑
  2012年3月13日
摘要: PendingIntent: //创建PendingIntent的方法: getActivity(Context context,int requestCode,Intent intent,int flags) //启动一个Activity getBroadcast(Context context,int requestCode,Intent intent,int flags) //发送一个广播 getService(Context context,int requestCode,Intent intent,int flags) //... 阅读全文
posted @ 2012-03-13 17:19 lee0oo0 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 1.AppWidgetProviderInfo对象: 为App Widget提供元数据(meta-data),包括布局,更新频率等等数据。这个对象被定义在res/xml目录当中。 <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="294dp" android:minHeight="72dp" android:updatePeriodMillis="86400000" 阅读全文
posted @ 2012-03-13 16:22 lee0oo0 阅读(435) 评论(0) 推荐(0) 编辑