public static StartAPKInfo parseStartAPKJson(InputStream inputStream)
{
Log.i(TAG, "parsePlaylistJson ");
StartAPKInfo info = new StartAPKInfo();
StringBuffer out = new StringBuffer();
byte[] b = new byte[4096];
try {
for (int n; (n = inputStream.read(b)) != -1;) {
out.append(new String(b, 0, n));
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
String str = out.toString();
JSONObject obj = null;
Iterator item = null;
try {
obj = new JSONObject(str);
item = obj.keys();
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return null;
}
while (item.hasNext()) {
try {
String key = (String) item.next();
String s = obj.getString(key);
if (key.equalsIgnoreCase("priority")) {
info.priority = s;
}
else if (key.equalsIgnoreCase("category"))
{
info.category= s;
}
else if (key.equalsIgnoreCase("source"))
{
info.source = s;
}
else if (key.equalsIgnoreCase("source_package"))
{
info.source_package = s;
}
else if (key.equalsIgnoreCase("video_tag"))
{
info.video_tag = s;
}
else if (key.equalsIgnoreCase("title"))
{
info.title = s;
}
else if (key.equalsIgnoreCase("img_url"))
{
info.img_url = s;
}
else if (key.equalsIgnoreCase("callback_action"))
{
info.callback_action = s;
}
else if (key.equalsIgnoreCase("callback_method"))
{
info.callback_method = s;
}
else if (key.equalsIgnoreCase("callback_flag"))
{
info.callback_flag = s;
}
else if (key.equalsIgnoreCase("callback_key"))
{
info.callback_key = s;
}
else if (key.equalsIgnoreCase("callback_value"))
{
info.callback_value = s;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return info;
}