xml - android error in listview -
<?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_row_selector" android:padding="8dp" > <!-- thumbnail image --> <com.android.volley.toolbox.networkimageview android:id="@+id/thumbnail" android:layout_width="80dp" android:layout_height="80dp" android:layout_alignparentleft="true" android:layout_marginright="8dp" /> <!-- movie title --> <textview android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/thumbnail" android:layout_torightof="@+id/thumbnail" android:textsize="@dimen/title" android:textstyle="bold" /> <!-- rating --> <textview android:id="@+id/rating" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/title" android:layout_margintop="1dip" android:layout_torightof="@+id/thumbnail" android:textsize="@dimen/rating" /> <!-- genre --> <textview android:id="@+id/genre" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/rating" android:layout_margintop="5dp" android:layout_torightof="@+id/thumbnail" android:textcolor="@color/genre" android:textsize="@dimen/genre" /> <!-- release year --> <textview android:id="@+id/releaseyear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:textcolor="@color/year" android:textsize="@dimen/year" /> </relativelayout>
public view getview(int position, view convertview, viewgroup parent) { if (inflater == null) inflater = (layoutinflater) activity .getsystemservice(context.layout_inflater_service); if (convertview == null) convertview = inflater.inflate(r.layout.list_row, null); }
i re-edit answer try change context;
change context in inflater "context" instead of activity ,these 2 method layoutinflater:
getactivity().getlayoutinflater();
getcontext().getsystemservice(layout_inflater_service);
Comments
Post a Comment