Android 类列表视图按钮

Android 类列表视图按钮,android,listview,Android,Listview,我在我的应用程序中使用Listview,现在我想添加一个like按钮 public void likeButton(View view) { new PostComment().execute(); } 会后班 我想获得特定帖子的真实帖子id,点击按钮。目前,我在listview中显示post_id,在post中显示textview。但是我如何将这个post_id获取到字符串post= 您将这些用户和post值存储在哪里?我从JSON请求中获

我在我的应用程序中使用Listview,现在我想添加一个like按钮

  public void likeButton(View view)

    {

        new PostComment().execute();

         }
会后班


我想获得特定帖子的真实帖子id,点击按钮。目前,我在listview中显示post_id,在post中显示textview。但是我如何将这个post_id获取到字符串post=

您将这些用户和post值存储在哪里?我从JSON请求中获取这些数据,它们的存储方式如下:JSONObject obj=response.getJSONObjecti;电影=新电影;movie.setUsernameobj.getStringusername;movie.setPOST_IDobj.getStringpost_id;//将电影添加到电影数组movieList.add0,电影;您需要从json提要获取这些值并更新listview,这是您的要求吗?
 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 for success tag
       int success;



        // Just random dummy data
        // I need to get the 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 to 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 the dialog once product deleted
        pDialog.dismiss();
        if (file_url != null){
            Toast.makeText(MainActivity.this, file_url, Toast.LENGTH_LONG).show();
        }

    }

}
        // Just random dummy data
        // I need to get the real values here
        String user = "44";
        String post = "12";