WEB开发网
开发学院手机开发Android 开发 Android判断SDK版本及判断是否联网 阅读

Android判断SDK版本及判断是否联网

 2013-04-11 14:50:11 来源:开发学院   
核心提示:public static int getSDKVersionNumber() {int sdkVersion;try {sdkVersion = Integer.valueOf(android.os.Build.VERSION.SDK);} catch (NumberFormatException e) {sdkVe
public static int getSDKVersionNumber() {

		int sdkVersion;
		try {
			sdkVersion = Integer.valueOf(android.os.Build.VERSION.SDK);

		} catch (NumberFormatException e) {

			sdkVersion = 0;
		}
		return sdkVersion;
	}
public static boolean hasInternet(Activity activity) {
		ConnectivityManager manager = (ConnectivityManager) activity
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo info = manager.getActiveNetworkInfo();
		if (info == null || !info.isConnected()) {
			return false;
		}
		if (info.isRoaming()) {
			return true;
		}
		return true;
	}

Tags:Android 判断 SDK

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接