I want my android app to detect a range of ip address basically, from 192.168.150.0 - .255 and i want it to put it in void onStart, i created an array but it doesnt work.
here is my java class for the main activity
MediaPlayer playMusic;
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
for(int array;array < 256;array++)
try {
if("192.168.150")
}
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
//playMusic.release();
}
/**
* Touch listener to use for in-layout UI controls to delay hiding the
* system UI. This is to prevent the jarring behavior of controls going away
* while interacting with activity UI.
*/
View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (AUTO_HIDE) {
delayedHide(AUTO_HIDE_DELAY_MILLIS);
}
return false;
}
};
Handler mHideHandler = new Handler();
Runnable mHideRunnable = new Runnable() {
@Override
public void run() {
mSystemUiHider.hide();
}
};
/**
* Schedules a call to hide() in [delay] milliseconds, canceling any
* previously scheduled calls.
*/
private void delayedHide(int delayMillis) {
mHideHandler.removeCallbacks(mHideRunnable);
mHideHandler.postDelayed(mHideRunnable, delayMillis);
}
}
and this is my java class to detect wifi when the app is open
public class WiFiChangeBroadcastReceiver extends BroadcastReceiver {
private String LOGTAG = getClass().getSimpleName();
@Override
public void onReceive(Context context, Intent intent) {
Log.d(LOGTAG, "WiFi Status Changed");
if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
NetworkInfo networkInfo = intent
.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
if (networkInfo.isConnected()) {
Log.d(LOGTAG,
"Wifi is connected: " + String.valueOf(networkInfo));
}
}
}
}