Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7876249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:08:21+00:00 2026-06-03T03:08:21+00:00

Following is the code of my activity I am using for sending an HTTP

  • 0

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.

Following is the error I am getting

 Multiple markers at this line
    - Syntax error, insert ")" to complete       ClassInstanceCreationExpression
    - Syntax error, insert ";" to complete BlockStatements

I’m new to Java. Please help.

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") +
                        "&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();
        }
    };

EDIT :

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

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

Following is the code :

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

                    String urlParameters = "";

                    try {
                        urlParameters = "fName=" + URLEncoder.encode("yash", "UTF-8") +
                        "&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);
                }
            });

The error is on this line :

public void run(){
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:08:22+00:00Added an answer on June 3, 2026 at 3:08 am

    Re second error. I think the problem is the @Override annotation. If you are compiling with Java 1.5 as source level, that annotation means that you need to override a method in a superclass. But you are (just) implementing a method in an interface.

    Either remove the annotation, or change the source level to Java 1.6 or later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following code to open a new Activity from my current
I have the following code that suppose used to Send Data to Server using
I have a main activity that launches a child activity using the following code:
I tried using the following code in .java(main activity): final ImageView diskView1 = (ImageView)
Using the following code: # List all servers $servers = Get-QADComputer -OSName *server*,*hyper-v* #
I'm using the following code to populate listview Oncreate method: SimpleAdapter adapter = new
I am using following code to start activity when user pressing search button on
i am using following code to start my activity public void onClick(View v) {
i m using the following code to finish an activity but i want to
I am using following code to open an activity as a popup window using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.