나는 응용 프로그램이 중지되었지만 오류가 발생하지 않았습니다. YouTube 제목에서 arraylist를 채우고 싶습니다 .JTube 데이터를 구문 분석하고 싶지만 프로그램이 중지되었습니다. 어떻게 해결할 수 있습니까? 뭔가 잘못 됐어? 왜 jsonc를 사용하는youtube Json - C error
feedUrl="https://gdata.youtube.com/feeds/api/users/muyap/uploads?v=2&alt=jsonc&max-results=2";
HttpClient client = new DefaultHttpClient();
HttpGet getRequest = new HttpGet(feedUrl);
HttpResponse responce;
try {
responce = client.execute(getRequest);
StatusLine statusLine = responce.getStatusLine();
int statusCode = statusLine.getStatusCode();
if(statusCode!=200)
{
Toast.makeText(YouTube.this, "Yükleme Gerçekleşmedi", Toast.LENGTH_LONG).show();
}else{
InputStream JsonStream=responce.getEntity().getContent();
BufferedReader reader= new BufferedReader(new InputStreamReader(JsonStream));
StringBuilder builder = new StringBuilder();
String line;
while((line=reader.readLine())!=null)
{
builder.append(line);
}
String JSONdata = builder.toString();
Log.i("JsonData",JSONdata);
JSONObject json = new JSONObject(JSONdata);
JSONObject data = json.getJSONObject("data");
JSONArray items=data.getJSONArray("items");
for(int i=0;i<items.length();i++)
{
JSONObject video=items.getJSONObject(i);
videoArrayList.add(video.getString("title"));
}
list = (ListView)findViewById(R.id.listView1);
list.setAdapter(new ArrayAdapter<String>(YouTube.this, android.R.layout.simple_list_item_1,videoArrayList));
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
내가 로그인 페이지 1을 보여주고 싶은, 2
''로그 '에'JSONdata'가 출력되어 있습니까? – Hariharan
@ Tamilan 아니요, 활동이 실행될 때 앱이 중지됩니다. –
오류가 발생하지 않습니다. 로그에 아무 것도 출력하지 않습니다. 여전히 안다면 앱을 다시 실행하십시오. 프로젝트를 청소하고 실행하십시오. – Hariharan