내 inflator를 초기화 할 때 customList를 채울 때 오류가 발생합니다. 로그 캣 오류 :Android 맞춤 목록 inflateException 오류
android.view.InflateException: Binary XML file line #20: Error inflating class
나는 성공적으로 hashmap<string, string>
웁니다. 그럼 난 arrayList<HashMap<string, string>.
..이 모든 배경 스레드에서 추가 할 수 있습니다.
그런 다음 내 목록 'list=(ListView)findViewById(R.id.list);
'및 setAdapter를받습니다.
내 질문 업데이트 - contact_list_row.xml에서 imageviews를 제거하면 작동합니다! 이건 내 머리를 망가 뜨리고있어! 나는 내가 '응용 프로그램 중지'일단 재미있는 것은이
vi = inflater.inflate(R.layout.contact_list_row, null);
오류를 다음 줄을 실행하고 다시 활동에서 볼이 채워질 때 다시 사용자 지정 목록 그것을 누를 때
오류가 온다 .
class refreshThread extends AsyncTask<String, String, String>
{
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute()
{
super.onPreExecute();
rDialog = new ProgressDialog(Cool_Activity.this);
rDialog.setMessage("Analysing your buddys. Please wait...");
rDialog.setIndeterminate(false);
rDialog.setCancelable(false);
rDialog.show();
}
@SuppressWarnings("unchecked")
@Override
protected String doInBackground(String... args)
{
//What to output in each listitem in UI
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", "1");
map.put("contact", contact);
map.put("Sent", "Sent: "+"0.1");
map.put("Received", "Received: "+String.format("%.1f", score));
map.put("duration", type);
map.put("thumb_url", "http://upload.wikimedia.org/wikipedia/commons/d/d3/Albert_Einstein_Head.jpg");
map.put("sent_value", "0.01");
map.put("rec_value", score.toString());
// adding HashList to ArrayList
resultsList.add(map);
//}
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url)
{
// dismiss the dialog after getting all questions
rDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable()
{
public void run()
{
/**
* Updating stats ui
* */
list=(ListView)findViewById(R.id.list);
// Getting adapter by passing xml data ArrayList
adapter=new Contacts_LazyAdapter(Cool_Activity.this, resultsList);
list.setAdapter(adapter);
// Click event for single list row
/* list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
}
});*/
}
});
}
}
내 어댑터 로직 .... 당신은 특정 IDS 여러 번을 할당하고
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_selector"
android:orientation="horizontal"
android:padding="5dip" >
<!-- ListRow Left sied Thumbnail image -->
<LinearLayout
android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:background="@drawable/image_bg"
android:padding="3dip" >
<ImageView
android:id="@+id/image_app"
android:layout_width="50dip"
android:layout_height="50dip"
android:src="@drawable/red" />
</LinearLayout>
<!-- Title Of Song -->
<TextView
android:id="@+id/textView_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/thumbnail"
android:layout_toRightOf="@id/thumbnail"
android:text="Niamh"
android:textColor="#040404"
android:textSize="15dip"
android:textStyle="bold"
android:typeface="sans" />
<!-- Artist Name -->
<TextView
android:id="@+id/TextView_SentResult"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_below="@id/textView_name"
android:layout_marginTop="1dip"
android:layout_toRightOf="@id/thumbnail"
android:text="Sent: 17.5"
android:textColor="#343434"
android:textSize="18dip" />
<!-- Rightend Duration -->
<TextView
android:id="@+id/duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/textView_name"
android:layout_marginRight="5dip"
android:gravity="right"
android:text="5:45"
android:textColor="#10bcc9"
android:textSize="10dip"
android:textStyle="bold"
android:visibility="invisible" />
<!-- Rightend Arrow -->
<ImageView
android:id="@+id/imageView_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/arrow_blue"
android:visibility="invisible" />
<LinearLayout
android:id="@+id/thumbnail2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/duration"
android:layout_toLeftOf="@id/duration"
android:background="@drawable/image_bg"
android:padding="3dip" >
<ImageView
android:id="@+id/rec_image"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_centerVertical="true"
android:src="@drawable/red" />
</LinearLayout>
<TextView
android:id="@+id/TextView_ReceivedResult"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/TextView_SentResult"
android:layout_alignBottom="@id/TextView_SentResult"
android:layout_marginLeft="22dp"
android:layout_toRightOf="@id/textView_name"
android:text="Received: 16.5"
android:textColor="#343434"
android:textSize="18dip" />
</RelativeLayout>
R.layout.contact_list_row – SemaphoreMetaphor
에서이 코드가 추가 된 후, 지연에 대한 사과는 ... – Fearghal
간단한 노트 BT는이 문제와 관련이없는, onPostExecute는 UI에 이미 : 그 후, 그대로 사용 스레드가 필요 없어 runOnUIxx 메서드 – Atrix1987