android - Listview crashes when scrolling only on kitkat -


But it only crashes on KitKat devices and it also works on KitKat emulator, so I do not get anything in the logk If I remove imageView.setImageResource (imageId.get (status)) then works on APK KitKat devices, but I need it.

Here is my code:

Custom list:

  Arrayadaptor expands in public category customists & lt; String & gt; {Context of personal end activity; Personal Final List & lt; String & gt; Name; Private Final List & lt; Integer & gt; ImageId; Private typeface myFont; Public catalog (activity reference, list & lt; string & gt; name, list & lt; integer & gt; image id) {super (references, r.lit.list_single, name); This.context = context; This.names = names; This.imageId = imageId; } @ Override Public View getView (View of Entity, View View, ViewGroup Parent) {layoutInflator inflater = context.getLayoutInflater (); See row view- inflater.inflate (R.layout.list_single, empty, true); TextView txtTitle = (text view) rowView.findViewById (R.id.txt); ImageView imageView = (ImageView) rowView.findViewById (R.id.img); Shared references sp = context.getSharedPreferences ("setting", 0); String font_name = sp.getString ("font", "yeken.ttf"); Float text_size = sp.getFloat ("size", 18); If (font_name.equals ("yeken.ttf")) {myFont = Typeface.createFromAsset (context.getAssets (), font_name); } Otherwise myFont = android.graphics.Typeface.DEFAULT; TxtTitle.setText (names.get (status)); If (myFont! = Null) txtTitle.setTypeface (myFont); TxtTitle.setTextSize (text_size); ImageView.setImageResource (imageId.get (status)); Return line view; }}  

list_single.xml:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; TableLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "match_parent" & gt; & Lt; TableRow Android: Gravity = "Right" Android: Background = "@ Draubable / List_item_bg2" & gt; & Lt; LinearLayout Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" & gt; & Lt; TextView android: id = "@ + id / txt" Android: Layout_width = "Wrap_content" Android: Layout_height = "Fill_parent" android: text = "test" android: gravity = "center" / & gt; & Lt; imageView android: id = "@ + id / img" Android: layout_width = "70dip" Android: layout_height = "70dip" android: src = "@ drawable / gray_button" Android: layout_marginLeft = "10dip" Android: layout_marginRight = "10dip" /> & Lt; / LinearLayout & gt; & Lt; / TableRow & gt; & Lt; imageView android: id = "@ + id / imageView1" Android: layout_width = "fill_parent" Android: layout_height = "2dip" Android: layout_margin = "2dip" android: background = "@ drawable / list_devider" / & gt; & Lt; / TableLayout & gt;  


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -