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

开关Android的APN网络的实现

 2010-08-21 06:20:00 来源:WEB开发网   
核心提示:}});}public void openAPN(){List list = getAPNList();for (APN apn : list) {ContentValues cv = new ContentValues();cv.put("apn", APNMatchTools.matchAPN(

}

});

}

public void openAPN(){

List list = getAPNList();

for (APN apn : list) {

ContentValues cv = new ContentValues();

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

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

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

}

}

public void closeAPN(){

List list = getAPNList();

for (APN apn : list) {

ContentValues cv = new ContentValues();

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;

}

}

package cc.mdev.apn;

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

Tags:开关 Android APN

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接