package com.samples.network.wifisettings;

import android.app.ListActivity;
import android.content.Intent;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class WiFiSettingsActivity extends ListActivity {
	private String[] actions = {
			Settings.ACTION_WIFI_IP_SETTINGS,
			Settings.ACTION_WIFI_SETTINGS,
			Settings.ACTION_WIRELESS_SETTINGS,
			WifiManager.ACTION_PICK_WIFI_NETWORK
	};		
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		try {
		//setListAdapter(new ArrayAdapter<String>(this,
		//		android.R.layout.simple_list_item_1, actions));
		setListAdapter(new ArrayAdapter<String>(this, 
				android.R.layout.simple_list_item_1, actions));
		}
		catch (Exception e) {
				Toast.makeText(this, e.toString(), 3000).show();
		}
			
	}
		
	public void onListItemClick(ListView parent, View v, int pos, long id)
	{
		try {
		Intent intent = new Intent(actions[pos]);
		startActivity(intent);
		}
		catch (Exception e) {
			Toast.makeText(this, e.toString(), 3000).show();
		}
	}
}