그리고 String [] FROM을 올바르게 사용하여 커서를 매핑하고 있습니까?MainActivity에서 SimpleCursorAdapter가 작동하지 않습니다.
내가 MainActivity 내에서 OnCreate 방법이 제공되는 오류에 SimpleCursorAdapter를 사용하고있어서, SimpleCursorAdapter은 (MainActivity는, INT가, 커서, 문자열 [] [] INT)
내가 API 문서의 생성자를 체크 한타입 MainActivity에 대한 정의되지
는에 나는 여기에
public SimpleCursorAdapter (Context context, int layout, Cursor c, String[] from, int[] to)**
올바르게되어 사용하고있어서, 내 MainActivity.java : 당신이 SimpleCursorAdapter
의 객체를 생성하기위한 new
을 사용하는 것을 잊지
adapter =new SimpleCursorAdapter(MainActivity.this,
^^^ android.R.layout.two_line_list_item,cursor,FROM,TO);
:로
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
R.layout.listview
의 난 당신의 오류 목록 = (ListView에가) findViewById를 (R.layout.listview가) (의 ListView) findViewById를 (R.id.listview) – vinoth감사 @vinoth 나는 목록을 가지고 =이 그것을 변경할 생각 변경했지만 여전히 SimpleCursorAdapter에 대한 오류가 발생했습니다 –
ID로보기를 찾고 있으므로 R.id.listviewid.try와 같은 id 값을 부여해야합니다. – vinoth