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 difference between current time,serverTime in seconds/milliSeconds/Hours in Android/JAVA

http://www.roseindia.net/java/beginners/DateDifferent.shtml

import java.util.Calendar;
 
public class DateDifferent{  
  public static void main(String[] args){
  Calendar calendar1 = Calendar.getInstance();
  Calendar calendar2 = Calendar.getInstance();
  calendar1.set(20070110);
  calendar2.set(20070701);
  long milliseconds1 = calendar1.getTimeInMillis();
  long milliseconds2 = calendar2.getTimeInMillis();
  long diff = milliseconds2 - milliseconds1;
  long diffSeconds = diff / 1000;
  long diffMinutes = diff / (60 1000);
  long diffHours = diff / (60 60 1000);
  long diffDays = diff / (24 60 60 1000);
  System.out.println("\nThe Date Different Example");
  System.out.println("Time in milliseconds: " + diff
 + 
" milliseconds.");
  System.out.println("Time in seconds: " + diffSeconds
 + 
" seconds.");
  System.out.println("Time in minutes: " + diffMinutes
" minutes.");
  System.out.println("Time in hours: " + diffHours
" hours.");
  System.out.println("Time in days: " + diffDays
" days.");
  }
}
The output of the program is given below:
C:\rajesh\kodejava>javac DateDifferent.java
C:\rajesh\kodejava>java DateDifferent
The Date Different Example
Time in milliseconds: 14860800000 milliseconds.
Time in seconds: 14860800 seconds.
Time in minutes: 247680 minutes.
Time in hours: 4128 hours.
Time in days: 172 days.

Comments