Page 495 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 495
}
return super.onOptionsItemSelected(item);
}
}
(5) NetworkUtil.java
package minsu.elevator;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by user on 2016-10-10.
*/
public class NetworkUtil {
public static int TYPE_WIFI = 1;
public static int TYPE_MOBILE = 2;
public static int TYPE_NOT_CONNECTED = 0;
//activity의 context 값을 받아 위에 약속된 값을 반환한다.
public static int getConnectivityStatus(Context context) {
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
인천전자마이스터고등학교
- 488 -