onListItemClick of Android ListView - How to activate onListItemCLick and deactivate when needed? -



onListItemClick of Android ListView - How to activate onListItemCLick and deactivate when needed? -

i have activity loads vouchers on server customer's phone. in activity, have 2 buttons. first button vouchers bought customer. sec list of available vouchers client can buy.

now, problem is, need onlistitemclick list of available vouchers (when click on vouchers, have alternative buy). utilize listview listactivity. when set onlistitemclick, event apply bought vouchers well.

how can somehow deactivate onlistitemclick event when customers view own vouchers , activate when customers choosing voucher buy?

this code of 2 buttons:

public void btn_own(view v){ if(!isconnected){ toast toast = toast.maketext(voucher.this, "cannot connect internet", toast.length_long); toast.show(); return; //finish(); } if(email.equals("")){ toast toast = toast.maketext(voucher.this, "please log in see voucher!", toast.length_long); toast.show(); }else{ url = "http://wswob.somee.com/wobservice.svc/checkownvoucher/" + email + "/"; new checkingtask().execute(); } } public void btn_shop(view v){ if(!isconnected){ toast toast = toast.maketext(voucher.this, "cannot connect internet", toast.length_long); toast.show(); return; //finish(); } url = "http://wswob.somee.com/wobservice.svc/showvoucher"; new mytask().execute(); }

i'm new android, came know have utilize custom adapter (as far know). wonder how can while i'm using asynctask , pass different parameters when need execute different tasks web service.

this how list after calling web service:

protected void onpostexecute(void result){ super.onpostexecute(result); listadapter adapter = new simpleadapter( voucher.this, voucherlist, r.layout.voucher_list, new string[]{"detail","price"}, new int[]{r.id.detail, r.id.price}); setlistadapter(null); setlistadapter(adapter); }

you should able utilize setenabled true or false command when user can click link or button.

android android-listview listactivity

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -