Android에서 서비스를 개발하고 Marakana Yamba 예제를 따라 배우는 중입니다.winterwell.jtwitter.TwitterException : org.json.JSONException : 값 <! java.lang.String 유형의 DOCTYPE을 JSONArray로 변환 할 수 없습니다.
트윗과 일정 간격을 가져 오는 UpdaterService와 선택시 트윗을 가져 오는 RefreshService를 만들었습니다. 코드가 서비스를 모두뿐만 UpdateService는 오류 withput 실행하는 동안 오류 아래 얻고있다 RefreshService에서 동일 트윗을 당기는
는 :
다음02-19 14:31:41.359 1323-1345/com.tutorial.yamba.yamba W/System.err﹕ winterwell.jtwitter.TwitterException: org.json.JSONException: Value (JSONArray.java:96) 02-19 14:31:41.379 1323-1345/com.tutorial.yamba.yamba W/System.err﹕ at org.json.JSONArray.(JSONArray.java:108) 02-19 14:31:41.389 1323-1345/com.tutorial.yamba.yamba W/System.err﹕ at winterwell.jtwitter.Twitter$Status.getStatuses(Twitter.java:339) 02-19 14:31:41.389 1323-1345/com.tutorial.yamba.yamba W/System.err﹕ ... 7 more
RefreshService 클래스
package com.tutorial.yamba.yamba;
import android.app.IntentService;
import android.content.Intent;
import android.util.Log;
import java.util.List;
import winterwell.jtwitter.Twitter;
import winterwell.jtwitter.Twitter.Status;
import winterwell.jtwitter.TwitterException;
public class RefreshService extends IntentService {
static final String TAG = "RefreshService";
Twitter twitter;
public RefreshService() {
super(TAG);
}
@Override
public void onCreate() {
super.onCreate();
twitter = new Twitter(someusername, somepassword);
twitter.setAPIRootUrl("http://www.yamba.marakana.com/api");
Log.d(TAG, "onCreate");
}
@Override
protected void onHandleIntent(Intent intent) {
Log.d(TAG,"onhandleIntent enter");
try {
List<Status> timeline = twitter.getPublicTimeline();
Log.d(TAG,timeline.size()+"");
for (Status status : timeline)
{
Log.d(TAG, String.format("%s: %s", status.user.name, status.text));
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "onDestroy");
}
}
입니다
도움이 될 것입니다.
감사합니다.
에서 최신 JTwitter을 다운로드하지만, 코드의 같은 라인은 UpdateService 클래스에서 노력하고 있습니다. – user3275095
@ user3275095 UpdateService 클래스? Jtwitter는 하나도 가지고 있지 않습니다. 이 수업은 자습서의 수업입니까? 자세한 내용을 입력하십시오. –
정확합니다. 두 클래스 모두 튜토리얼에 있습니다. – user3275095