Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

android - AsyncTask onPostExecute never gets called -


i not sure doing wrong onpostexecute never gets called.

  • created base class called baseactivity.java
  • from original activity extended class.
  • placed posttoopenfeint class inside baseactivity
  • called ui thread main activity doing:

    new posttoopenfeint.execute(); 

the onpreexecute(), doinbackground(..) gets triggered, reason onpostexecute never gets called.

thank in advance!

dave

 private class posttoopenfeint extends asynctask<void, void, void> {   /*    * (non-javadoc)    *     * @see android.os.asynctask#doinbackground(params[])    */   @override   protected void doinbackground(void... params) {    // work here    return null;   }     /*    * (non-javadoc)    *     * @see android.os.asynctask#onpostexecute(java.lang.object)    */   @override   protected void onpostexecute(void result) {    // todo auto-generated method stub    super.onpostexecute(result);    toast.maketext(mainscreen.this, "done syncing", toast.length_long).show();   }    /*    * (non-javadoc)    *     * @see android.os.asynctask#onpreexecute()    */   @override   protected void onpreexecute() {    // todo auto-generated method stub    super.onpreexecute();    toast.maketext(mainscreen.this, "about sync scores", toast.length_long).show();   } 

looking more, able observe. example if place call:

 new posttoopenfeint.execute(); 

right after oncreate of activity, works fine. if place call inside button listener.

settingsbutton.setonclicklistener(new view.onclicklistener() { public void onclick(view v) {    new posttoopenfeint.execute(); } }); 

the onpostexecute() never gets called, not sure doing wrong. restriction read call ui thread , calling ui thread.

i had similiar problem now. extending asynctask<integer,integer,integer> , onpostexecute method looked like:

protected void onpostexecute(int result) 

this seemed ok me, again i'm more of .net guy java guy. changed to:

protected void onpostexecute(integer result) 

because reason java thinks there difference between int , integer?

i think problem you're declaring return type void in your:

extends<void,void,void> 

that means no params, no progress , no result. if want execute when it's done, think need give kind of value , integer or boolean.

if change extends to:

<void,void,integer> 

now passing no params, not publishing progress, returning value. change onpostexecute method accept integer:

protected void onpostexecute(integer result) 

then change return in doinbackground method like:

return 1; 

then should execute you.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -