Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Android中回复现有的评论系统_Java_Php_Android_Mysql - Fatal编程技术网

Java 在Android中回复现有的评论系统

Java 在Android中回复现有的评论系统,java,php,android,mysql,Java,Php,Android,Mysql,因此,我们的应用程序中有一个评论系统,现在我们希望能够添加对特定评论的回复,比如Facebook墙 我们发布评论的Java方法: class PostComment extends AsyncTask<String, String, String> { @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog

因此,我们的应用程序中有一个评论系统,现在我们希望能够添加对特定评论的回复,比如Facebook墙

我们发布评论的Java方法:

class PostComment extends AsyncTask<String, String, String> {

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(AddCommentActivity.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;
        String post_title = title.getText().toString();
        String post_message = message.getText().toString();

        //We need to change this:
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(AddCommentActivity.this);
        String post_username = sp.getString("username", "anon");

        try {
            // Building Parameters
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("username", post_username));
            params.add(new BasicNameValuePair("title", post_title));
            params.add(new BasicNameValuePair("message", post_message));

            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) {
                Log.d("Comment Added!", json.toString());    
                finish();
                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(AddCommentActivity.this, file_url, Toast.LENGTH_LONG).show();
        }
    }
}
}
我猜我们会制作一个
arraylist
,从原始评论中选择
commentid
,然后将其链接到回复,但我不知道怎么做。我通常不知道如何从这里开始

reply_id (INT AI)
reply_content (text)
reply_postid (INT)
reply_byusername (varchar)