Executing HTTP request inside a thread - Error
<p>Following is the code of my activity I am using for sending an HTTP request to the server in a new thread. However, there is a syntactical error that I'm not able to figure out.</p>

<p>Following is the error I am getting</p>

<pre><code> Multiple markers at this line
    - Syntax error, insert ")" to complete       ClassInstanceCreationExpression
    - Syntax error, insert ";" to complete BlockStatements
</code></pre>

<p>I'm new to Java. Please help.</p>

<pre><code>public class RegisterActivity extends Activity {

    private static final String TAG = "RegisterActivity";

    /*
     * Event listener for registration button. This will load the loading view and fire up the HTTP request to the server
     */
    public OnClickListener registrationBtnListener = new OnClickListener() {
        public void onClick(View v) {

            Thread trd = new Thread(new Runnable(){
                @Override
                public void run(){

                    String urlParameters = "";

                    try {
                        urlParameters = "fName=" + URLEncoder.encode("John", "UTF-8") +
                        "&amp;lName=" + URLEncoder.encode("Smith", "UTF-8");
                    } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                    Http.post("http://192.168.1.101/project/test.php", urlParameters);
                }
            }
            trd.run();
        }
    };
</code></pre>

<p>EDIT : </p>

<p>Fixed by adding a ); before trd.run(). But now, I get a different error :</p>

<pre><code>Multiple markers at this line
    - The method run() of type new Runnable(){} must override a superclass 
     method
    - implements java.lang.Runnable.run
</code></pre>

<p>Following is the code : </p>

<pre><code>Thread trd = new Thread(new Runnable(){
                @Override
                public void run(){

                    String urlParameters = "";

                    try {
                        urlParameters = "fName=" + URLEncoder.encode("yash", "UTF-8") +
                        "&amp;lName=" + URLEncoder.encode("desai", "UTF-8");
                    } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                    Http.post("http://192.168.1.101/bworld/test.php", urlParameters);
                }
            });
</code></pre>

<p>The error is on this line : </p>

<pre><code>public void run(){
</code></pre>
