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 parse XML file and get the Parsed data, in Android(used in Movie_Project)

package org.example.Movie.XMLFileData;
import java.io.File;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class Audios {

 public ArrayList<String> getAudioList()
 {
  ArrayList<String>   herosNames=new ArrayList<String>();
  try {
   File fXmlFile = new File("http://9.dharani.org/Audios.xml");  
   DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
   DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
   Document doc = dBuilder.parse(fXmlFile);
   doc.getDocumentElement().normalize();
 
   //System.out.println("Root element :" + doc.getDocumentElement().getNodeName());
   NodeList nList = doc.getElementsByTagName("Movie"); 
  
   for (int temp = 0; temp < nList.getLength(); temp++) { 
      Node nNode = nList.item(temp);
      if (nNode.getNodeType() == Node.ELEMENT_NODE) {
 
         Element eElement = (Element) nNode;         
         System.out.println("MovieName : " + herosNames.add(getTagValue("MovieName", eElement)));        
      }
   }
    } catch (Exception e) {
   e.printStackTrace();
    }
  return herosNames; }

 private static String getTagValue(String sTag, Element eElement) {
  NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes();
 
         Node nValue = (Node) nlList.item(0);
 
  return nValue.getNodeValue();
   }
}

above code used by just calling a method from other activity like:
Audios audio=new Audios();
ArrayList<String>  audioNames=audio.getAudioList();

Comments