Question and Answers에 기반한 앱을 개발 중입니다. 나는 그 예에 대한 검색 옵션을 계획하고, 의 데이터를 가져 오기 위해/원시 데이터베이스를 고해상도를 사용하고내 페이지의 검색 옵션
는 나는 바닥에 검색 창을 유지하고 내가 100 개 질문 내가하고 싶은 일이 있다고 45 번으로 가십시오. searchbox에 번호를 입력하십시오. 나는이 일에 대해 어떤 생각도 갖고 있지 않다. 솔루션
protected void loadQuestionset1() throws Exception {
try {
InputStream questionset1 = this.getBaseContext().getResources()
.openRawResource(R.raw.questionset1);
bReader = new BufferedReader(new InputStreamReader(questionset1));
StringBuilder quesString = new StringBuilder();
String aJsonLine = null;
while ((aJsonLine = bReader.readLine()) != null) {
quesString.append(aJsonLine);
}
Log.d(this.getClass().toString(), quesString.toString());
JSONObject quesObj = new JSONObject(quesString.toString());
quesList1 = quesObj.getJSONArray("Questions");
Log.d(this.getClass().getName(),
"Num Questions " + quesList1.length());
}
catch (Exception e){
} finally {
try {
bReader.close();
} catch (Exception e) {
Log.e("", e.getMessage().toString(), e.getCause());
}
}
}
public static JSONArray getQuesList1() {
return quesList1;
}
검색 코드를 직접 작성하십시오. 45 번째 질문의 데이터를 얻고 표시하십시오. – Raghunandan