final WifiManager wifiManager = (WifiManager) this
.getSystemService(Context.WIFI_SERVICE);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Enable Wifi?")
.setCancelable(false)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
wifiManager.setWifiEnabled(true);
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
finish();
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
On Friday, August 10, 2012 12:48:11 AM UTC-5, Meena Rengarajan wrote:
>
> How to Enable Wifi automatically in Android 2.2 in an alert box ? If i
> click Yes button then it should be enable and if i click no then
> application must be closed. Can anyone tell me this how should i do ?
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en