android - Listview like button -


i use listview in app, want add button.

  public void likebutton(view view)      {          new postcomment().execute();           } 

postcomment class

 class postcomment extends asynctask<string, string, string> {      @override     protected void onpreexecute() {         super.onpreexecute();         pdialog = new progressdialog(mainactivity.this);         pdialog.setmessage("posting comment...");         pdialog.setindeterminate(false);         pdialog.setcancelable(true);         pdialog.show();     }      @override     protected string doinbackground(string... args) {         // todo auto-generated method stub         // check success tag        int success;            // random dummy data         // need real values         string user = "44";         string post = "12";             try {             // building parameters             arraylist<namevaluepair> params = new arraylist<namevaluepair>();             params.add(new basicnamevaluepair("user_id", user));             params.add(new basicnamevaluepair("post_id", post));               log.d("request!", "starting");              //posting user data script             jsonobject json = jsonparser.makehttprequest(                     post_comment_url, "post", params);              // full json response             log.d("post comment attempt", json.tostring());              // json success element             success = json.getint(tag_success);             if (success == 1) {                  return json.getstring(tag_message);             }else{                 log.d("comment failure!", json.getstring(tag_message));                 return json.getstring(tag_message);              }         } catch (jsonexception e) {             e.printstacktrace();         }          return null;      }      protected void onpostexecute(string file_url) {         // dismiss dialog once product deleted         pdialog.dismiss();         if (file_url != null){             toast.maketext(mainactivity.this, file_url, toast.length_long).show();         }      }  } 

it works far, dummy data added mysql database. instead of dummy data:

        // random dummy data         // need real values here         string user = "44";         string post = "12"; 

i want real post_id of specific post, in wich button clicked. display post_id in listview textview in post. how can post_id string post = "";?


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -