이 코드를 사용하여 HTML 페이지에서 요소를 검색합니다.안드로이드에있는 ListView에 요소를 넣는 방법?
// Get all td's that are a child of a row - each game has 4 of these
Elements games = doc.select("tr > td.indexList1, tr > td.indexList2");
// Iterator over those elements
ListIterator<Element> gameIt = games.listIterator();
while (gameIt.hasNext()) {
// Get the title of the game
Element title = gameIt.next();
System.out.println(title.text());
// Unneeded elements
Element platform = gameIt.next();
Element genre = gameIt.next();
// Get the release date of the game
Element release = gameIt.next();
System.out.println(release.text() + "\[email protected]@@@@@");
}
어떻게하면 ListView에 title 요소에 대한 두 textviews와 release 요소에 대한 두 요소가 추가 될까요? 다음은 나에게이 오류
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): FATAL EXCEPTION: main
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): android.content.res.Resources$NotFoundException: Resource ID #0x7f050001
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.content.res.Resources.getValue(Resources.java:1014)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2049)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.content.res.Resources.getLayout(Resources.java:853)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.view.LayoutInflater.inflate(LayoutInflater.java:389)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:375)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:366)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.widget.AbsListView.obtainView(AbsListView.java:1970)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.widget.ListView.measureHeightOfChildren(ListView.java:1228)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.widget.ListView.onMeasure(ListView.java:1139)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.view.View.measure(View.java:10828)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.widget.LinearLayout.measureVertical(LinearLayout.java:613)
08-15 14:49:37.730: ERROR/AndroidRuntime(18945): at android.widget.LinearLayout.onMeasure(LinearLayout.java:519)
을 편집은-제공
는리스트 뷰는 항목에서 떨어져 자신을 추출하기 때문에 실제 항목에 대한 ListAdapter을 의미한다
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/outputTextView"
/>
<ListView android:layout_height="wrap_content" android:id="@+id/list" android:layout_width="match_parent"></ListView>
</LinearLayout>
의 중복 가능성 (http://stackoverflow.com/questions/7065756/how-to- load-these-elements-to-populate-a-list-in-android) – bmargulies
제대로 작동하지 않아 대답이 혼란 스럽습니다. –