Suspended while debugging Android with AsyncTask -
here part of activity codes:
button.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { iparser = new imageparser(mainactivity.this, earthqpicurl); iparser.execute(); } });
and part of asynctask codes:
asyncresponse lempar; *//this interface* public imageparser(context actv, string earthqpicurl){ this.actv=actv; this.earthqpicurl=earthqpicurl; this.lempar = (asyncresponse) actv; }
this interface code:
import android.graphics.bitmap; public interface asyncresponse { public void processfinish(bitmap output); }
i use same code parsing jsondata, works. when use same constructor after modification class name, show error while debugging:
thread [<1> main] (suspended (exception classcastexception)) imageparser.<init>(context, string) line:25 mainactivity$1.oncllick(view) line: 23
what's wrong code? can me? lot
these part of codes use in jsonparser:
asyncresponse delegate; public jsonparser(context actv,string url){ this.actv=actv; this.url = url; this.delegate = (asyncresponse) actv; }
same jsonparser, use interface named asyncresponse.
you casting object of type context
asyncresponse
:
this.lempar = (asyncresponse) actv;
this what's causing error.
Comments
Post a Comment