java - android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams -


there other related issues on not address situation (their error code has sort of recycling and/or bad cast calls client code).

my situation more complex.

i have code user can pull library of photos.

the thing is, working fine on 7 phones have, running api's 19+.

however have google nexus 4.3 that's running api 17. , crash log has none of code, library code. if can advise how might able code work around i'd ears:

fatal exception: main     java.lang.classcastexception: android.widget.framelayout$layoutparams cannot cast android.widget.abslistview$layoutparams             @ android.widget.gridview.onmeasure(gridview.java:1042)             @ android.view.view.measure(view.java:15848)             @ android.widget.relativelayout.measurechildhorizontal(relativelayout.java:728)             @ android.widget.relativelayout.onmeasure(relativelayout.java:477)             @ android.view.view.measure(view.java:15848)             @ android.widget.relativelayout.measurechildhorizontal(relativelayout.java:728)             @ android.widget.relativelayout.onmeasure(relativelayout.java:477)             @ android.view.view.measure(view.java:15848)             @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5008)             @ android.widget.framelayout.onmeasure(framelayout.java:310)             @ android.view.view.measure(view.java:15848)             @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5008)             @ android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1404)             @ android.widget.linearlayout.measurevertical(linearlayout.java:695)             @ android.widget.linearlayout.onmeasure(linearlayout.java:588)             @ android.view.view.measure(view.java:15848)             @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5008)             @ android.widget.framelayout.onmeasure(framelayout.java:310)             @ com.android.internal.policy.impl.phonewindow$decorview.onmeasure(phonewindow.java:2189)             @ android.view.view.measure(view.java:15848)             @ android.view.viewrootimpl.performmeasure(viewrootimpl.java:1905)             @ android.view.viewrootimpl.measurehierarchy(viewrootimpl.java:1104)             @ android.view.viewrootimpl.performtraversals(viewrootimpl.java:1284)             @ android.view.viewrootimpl.dotraversal(viewrootimpl.java:1004)             @ android.view.viewrootimpl$traversalrunnable.run(viewrootimpl.java:5481)             @ android.view.choreographer$callbackrecord.run(choreographer.java:749)             @ android.view.choreographer.docallbacks(choreographer.java:562)             @ android.view.choreographer.doframe(choreographer.java:532)             @ android.view.choreographer$framedisplayeventreceiver.run(choreographer.java:735)             @ android.os.handler.handlecallback(handler.java:730)             @ android.os.handler.dispatchmessage(handler.java:92)             @ android.os.looper.loop(looper.java:137)             @ android.app.activitythread.main(activitythread.java:5103)             @ java.lang.reflect.method.invokenative(native method)             @ java.lang.reflect.method.invoke(method.java:525)             @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737)             @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553)             @ dalvik.system.nativestart.main(native method) 

update

my offending class this:

 //special class works uil     //the holder gets re-used , gets new properties     static class reusablegridviewview extends framelayout     {         public imageview imageview;         public progressbar progressbar;          public reusablegridviewview(context context)         {             super(context);              setlayoutparams(new layoutparams((int)(0.325* viewhelper.screenwidthpx(context)),(int)(0.325* viewhelper.screenwidthpx(context))));              imageview = new imageview(context);             progressbar = new progressbar(context);              addview(imageview);             addview(progressbar);         } } 

im using ultimate image loader library , code uses above class.

 //i not call directly, listview decides when re use convert view , passes accordingly         @override         public view getview(int position, view convertview, viewgroup parent)         {             final viewholder holder;             view view = convertview;             if (view == null)             {                 view = new reusablegridviewview(parent.getcontext());                  holder = new viewholder();                 assert view != null;                 holder.imageview = ((reusablegridviewview)view).imageview;                 holder.progressbar = ((reusablegridviewview)view).progressbar;                 holder.imageview.setscaletype(imageview.scaletype.center_crop);                 view.settag(holder);             } else {                 holder = (viewholder) view.gettag();             }              //system.out.println(" " + holder + " ||| " + holder.imageview);             imageloader.getinstance()                     .displayimage(image_urls[position], holder.imageview, options, new simpleimageloadinglistener()                     {                         @override                         public void onloadingstarted(string imageuri, view view)                         {                             holder.progressbar.setprogress(0);                             holder.progressbar.setvisibility(view.visible);                         }                          @override                         public void onloadingfailed(string imageuri, view view, failreason failreason)                         {                             holder.progressbar.setvisibility(view.gone);                         }                          @override                         public void onloadingcomplete(string imageuri, view view, bitmap loadedimage)                         {                             holder.progressbar.setvisibility(view.gone);                         }                      }, new imageloadingprogresslistener()                     {                         @override                         public void onprogressupdate(string imageuri, view view, int current, int total)                         {                             holder.progressbar.setprogress(math.round(100.0f * current / total));                         }                     });              //set unselected             ((reusablegridviewview) view).removeselectionborder();             for(int = 0; < selected_images.length; i++)             {                 if(selected_images[i] == position)                 {                     //set cell selected                     ((reusablegridviewview) view).addselectionborder();                 }             }             return view;         } 

so turns out on api < 17 framelayout can't cast correctly abslistview params.

what did set abslistview layoutparams instead of framelayout params:

    setlayoutparams(new abslistview.layoutparams(100,100)); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -