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

开关Android的APN网络的实现

 2010-08-21 06:20:00 来源:WEB开发网   
核心提示:import java.util.ArrayList;import java.util.List;import android.app.Activity;import android.content.ContentValues;import android.database.Cursor;import android.

import java.util.ArrayList;

import java.util.List;

import android.app.Activity;

import android.content.ContentValues;

import android.database.Cursor;

import android.net.Uri;

import android.os.Bundle;

import android.util.Log;

import android.view.View;

import android.widget.Button;

/**

* 呃彦是Activity

* @author SinFrancis wong

* @site http://mdev.cc

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

* @since 2010-01-08

*/

public class Main extends Activity {

/** Called when the activity is first created. */

Uri uri = Uri.parse("content://telephony/carriers");

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

Button open= (Button) findViewById(R.id.open);

Button close= (Button) findViewById(R.id.close);

open.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

openAPN();

}

});

close.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

closeAPN();

}

});

}

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();

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

Tags:开关 Android APN

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