mercredi 18 mars 2015

how to convert json data into map string string

[unable to retrieve full-text content]

public String readFromSD(){
File newFolder = new File(Environment.getExternalStorageDirectory(), "Contacts");
File file = new File(newFolder,"/Allcontact.txt");
StringBuilder data = new StringBuilder();
try
{
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
data.append(line);
data.append('\n');
}
txtData.setText(data.toString());

try
{

JSONObject jobj = new JSONObject(data.toString());
JSONArray arr = new JSONArray(jobj);
//Toast.makeText(getApplicationContext(),"File Contents ==> " +arr.toString(),Toast.LENGTH_SHORT).show();
Map m = toMap(jobj);
m.get(jobj);

txtData.setText(m.toString());
}catch(Exception e){
e.getMessage();
}
}
catch (IOException e) {
}






how to convert json data into map string string

Aucun commentaire:

Enregistrer un commentaire