start Activity Setting Wireless - Android Activity

Android examples for Activity:Activity Start

Description

start Activity Setting Wireless

Demo Code


//package com.java2s;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;

import android.os.Build;

import android.provider.Settings;

public class Main {

    public static boolean startActivitySettingWireless(Context context) {
        Intent intent = new Intent();
        if (Build.VERSION.SDK_INT < 14) {
            intent.setAction(Settings.ACTION_WIRELESS_SETTINGS);
        } else {//from  www . j ava2 s.com
            intent.setAction(Settings.ACTION_SETTINGS);
        }
        try {
            context.startActivity(intent);
            return true;
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        }
        return false;
    }
}

Related Tutorials