jeudi 26 mars 2015

Read filename that is not hard coded from sd card


Vote count:

0




With this code, I am able to read an xml file:



try {

String file = Environment.getExternalStorageDirectory() + "/XML/coordinates.xml";
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser parser = factory.newPullParser();
FileInputStream fis = new FileInputStream(file);
parser.setInput(new InputStreamReader(fis));

int eventType = parser.getEventType();


while (eventType != XmlPullParser.END_DOCUMENT && !done) {
. . .
. . .
. . .
}
}


But what I want is for the filename to be not hard coded as I may not know the filename. Though I know the file extension and where it is located. What should I add in the code? TIA



asked 1 min ago







Read filename that is not hard coded from sd card

Aucun commentaire:

Enregistrer un commentaire