android > intent > 自动跳转到 系统 设置 页面

package wifi2.com;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;


import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Message;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;

public class Wifi2Activity extends Activity{
	// 右侧滚动条按钮
	private Button connect;


	private String sid;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		connect = (Button) findViewById(R.id.connect);
		
		
		connect.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
				Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
				int requestcode=1;
				startActivityForResult(intent, requestcode);
				
			
				//wifiAdmin.AddNetwork();
			}
		});
		
		
	
	}
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		
		if(requestCode == 1){
			Toast.makeText(Wifi2Activity.this, "yes", Toast.LENGTH_LONG).show();
			
		}else{
			Toast.makeText(Wifi2Activity.this, "no", Toast.LENGTH_LONG).show();
		}
		
	}
	//\\
			
}
 

相关推荐