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 donload a file and copy it in SDCard,and get file created date...in Android

 ///if SDCard is Existed then,download files categories.xml , Audios.xml , Reviews.xml , Video.xml files in SDCard as follows.
        try {
           
            URL url = new URL("http://9.dharani.org/Upendra/Category.xml");               
            InputStream input = url.openStream();               
        try {
            //place image in SdCard..
            //below two lines are same,but the difference is their API levels..
            //System.out.println("Local Path for sdcard==== "+getExternalFilesDir(null));//API Level-8
            System.out.println("Local Path for sdcard==== "+Environment.getExternalStorageDirectory()+"/Category.xml");//API Level-1                  
           
            OutputStream output = new FileOutputStream(Environment.getExternalStorageDirectory()+"/Category.xml");
            try {
                int aReasonableSize = 1000;
                byte[] buffer = new byte[aReasonableSize];
                int bytesRead = 0;
                while ((bytesRead = input.read(buffer, 0, buffer.length)) >= 0) {
                    output.write(buffer, 0, bytesRead);//buffer.length);
                }
            } //try
            finally {
                output.close();
            }//finally
        } finally {
            input.close();
        }//finally
        }catch (Exception e) {
            e.printStackTrace();
        }//catch
        ///code to get file last modified dateee
        File fXmlFile = new File("sdcard/Category.xml");
        Date localFileDate = new Date(fXmlFile.lastModified());
         System.out.println("---CategoryFilecreatedDate--"+localFileDate.toString());

Comments