WEB开发网
开发学院手机开发Android 开发 开关Android的APN网络的实现 阅读

开关Android的APN网络的实现

 2010-08-21 06:20:00 来源:WEB开发网   
核心提示:cv.put("apn", APNMatchTools.matchAPN(apn.apn)+"mdev");cv.put("type", APNMatchTools.matchAPN(apn.type)+"mdev");getContent

cv.put("apn", APNMatchTools.matchAPN(apn.apn)+"mdev");

cv.put("type", APNMatchTools.matchAPN(apn.type)+"mdev");

getContentResolver().update(uri, cv, "_id=?", new String[]{apn.id});

}

}

private List getAPNList(){

String tag = "Main.getAPNList()";

//current不为空表示可以使用的APN

String projection[] = {"_id,apn,type,current"};

Cursor cr = this.getContentResolver().query(uri, projection, null, null, null);

List list = new ArrayList();

while(cr!=null && cr.moveToNext()){

Log.d(tag, cr.getString(cr.getColumnIndex("_id")) + " " + cr.getString(cr.getColumnIndex("apn")) + " " + cr.getString(cr.getColumnIndex("type"))+ " " + cr.getString(cr.getColumnIndex("current")));

APN a = new APN();

a.id = cr.getString(cr.getColumnIndex("_id"));

a.apn = cr.getString(cr.getColumnIndex("apn"));

a.type = cr.getString(cr.getColumnIndex("type"));

list.add(a);

}

if(cr!=null)

cr.close();

return list;

}

public static class APN{

String id;

String apn;

String type;

}

}

APNMatchTools.java

Java代码

package cc.mdev.apn;

/**

* 呃彦是APN匹配,用於匹配移?或者?通的APN

* @author SinFrancis wong

* @site http://mdev.cc

* @wiki http://mdev.cc/wiki

* @since 2010-01-08

*

*/

public final class APNMatchTools {

public static class APNNet{

/**

* 中国移动cmwap

*/

public static String CMWAP = "cmwap";

/**

* 中国移动cmnet

*/

public static String CMNET = "cmnet";

//中国联通3GWAP设置 中国联通3G因特网设置 中国联通WAP设置 中国联通因特网设置

上一页  1 2 3 4 5 6  下一页

Tags:开关 Android APN

编辑录入:coldstar [复制链接] [打 印]
赞助商链接