Skip to main content

Featured

Android studio “SDK tools directory is missing”

Following 2 possible solutions will resolve this problem :  Solution1 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:" Delete your  ~/.Android*  folders (losing all of your settings :/). Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again (and fails due to my rubbish internet). Click the X on the wizard window. That will enable you to get to the normal welcome dialog. Go to Settings->Project Defaults->Project Structure and change the Android SDK location to the correct one. Solution 2 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:&quo

Code to find the Device is Tablet or Small Device,Android

public


boolean isTabletDevice(Context activityContext) {
// Verifies if the Generalized Size of the device is XLARGE to be

// considered a Tablet

boolean xlarge = ((activityContext.getResources().getConfiguration().screenLayout &

Configuration.
SCREENLAYOUT_SIZE_MASK) ==

Configuration.
SCREENLAYOUT_SIZE_XLARGE);

boolean large = ((activityContext.getResources().getConfiguration().screenLayout &

Configuration.
SCREENLAYOUT_SIZE_MASK) ==

Configuration.
SCREENLAYOUT_SIZE_LARGE);




// If XLarge, checks if the Generalized Density is at least MDPI

// (160dpi)

if (xlarge) {

DisplayMetrics metrics =
new DisplayMetrics();

Activity activity = (Activity) activityContext;

activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);


// MDPI=160, DEFAULT=160, DENSITY_HIGH=240, DENSITY_MEDIUM=160,

// DENSITY_TV=213, DENSITY_XHIGH=320

/* if (metrics.densityDpi == DisplayMetrics.DENSITY_DEFAULT

|| metrics.densityDpi == DisplayMetrics.DENSITY_HIGH

|| metrics.densityDpi == DisplayMetrics.DENSITY_MEDIUM

//|| metrics.densityDpi == DisplayMetrics.DENSITY_TV

|| metrics.densityDpi == DisplayMetrics.DENSITY_XHIGH) { */



// Yes, this is a tablet!

return true;

//}

}

else if (large) {

DisplayMetrics metrics1 =
new DisplayMetrics();

Activity activity1 = (Activity) activityContext;

activity1.getWindowManager().getDefaultDisplay().getMetrics(metrics1);


Log.d(
"is tablet","large???"+large);


// MDPI=160, DEFAULT=160, DENSITY_HIGH=240, DENSITY_MEDIUM=160,

// DENSITY_TV=213, DENSITY_XHIGH=320

/* if (metrics1.densityDpi == DisplayMetrics.DENSITY_DEFAULT

|| metrics1.densityDpi == DisplayMetrics.DENSITY_HIGH

|| metrics1.densityDpi == DisplayMetrics.DENSITY_MEDIUM

//|| metrics.densityDpi == DisplayMetrics.DENSITY_TV

|| metrics1.densityDpi == DisplayMetrics.DENSITY_XHIGH) {

*/


Log.d(
"is tablet","if large called.???"+large);


// Yes, this is a tablet!

return true;


// }

}


// No, this is not a tablet!

return false;

}

Comments