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 add two float values in Java and Android

Example 1:

float f1=(float) 101.9;
BigDecimal flotAddSubtract = new BigDecimal("0.2");
System.out.println("=====float values==="+new BigDecimal(f1+"").add(flotAddSubtract));


Example 2:
float f1=(float) 101.7;
BigDecimal step = new BigDecimal("0.2");
BigDecimal step1 = new BigDecimal(f1+"");
step1=step1.add(step);
System.out.println("=====float values==="+step1);


Example 3:
BigDecimal step = new BigDecimal("0.1");
for (BigDecimal value = BigDecimal.ZERO;
     value.compareTo(BigDecimal.ONE) < 0;
     value = value.add(step)) {
    System.out.println(value);
}

Comments