-1

I am beginner to android and developing an app. I connect to any particular wifi connection in my app. I want to generate a number like 1 or 2 or 3 or 4. That number I need for some other purpose. How to do this?

WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
if(wifiInfo.getSupplicantState() == SupplicantState.COMPLETED) {
    if(wifiInfo.getIpAddress() != 0) {
        if((wifiInfo.getIpAddress() == wifiIp) && (wifiInfo.getSSID().equals(wifiSSID))) {

            if (enableLogs)

        } else{
            if (enableLogs)
                wifiIp = wifiInfo.getIpAddress();
            wifiSSID = wifiInfo.getSSID();

}
martijnn2008
  • 3,406
  • 5
  • 29
  • 39
rakesh
  • 49
  • 2
  • 8

1 Answers1

0

If you want to generate a random number then use this:-

final int min = 10;
final int max = 100;
final int random = Random.nextInt((max - min) + 1) + min;
Ankesh kumar Jaisansaria
  • 1,523
  • 4
  • 24
  • 44