Shahid_9 0 Newbie Poster

I am working on an Android app in which I am submitting some variables in url in order to save the data in database what ever user enter in the text fileds but I am unable to do so as I am getting an error called ",Server error". I have tried many solutions on stack overflow like use a variable in a URL object in android and the other one Volley server error with null network response bit it didn't solved my problem. Here is my sample code for registering url

Context context; 
EditText username, address, phoneNumber; 
Button location, save; 
String macAddress; 

private final String REGISTER_URL = ""+username+address+macAddress+phoneNumber;

public static final String KEY_USERNAME = "name";
public static final String KEY_Address = "address";
public static final String KEY_PHONENO = "mobile";
public static final String KEY_MAC_ADDRESS = "mac";

//And this is how I am registeing a user//

private void registerUser() { 
    final String usernameStr = username.getText().toString().trim(); 
    final String addressStr = address.getText().toString().trim(); 
    final String phoneNoStr = phoneNumber.getText().toString().trim(); 

    StringRequest stringRequest = new StringRequest(Request.Method.POST, REGISTER_URL, 
            new Response.Listener<String>() { 
                public void onResponse(String response) { 
                    Toast.makeText(MainActivity.this, response, Toast.LENGTH_LONG).show(); 
            new Response.ErrorListener() { 
                public void onErrorResponse(VolleyError error) { 
                    Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_LONG).show(); 
            }) { 
        protected Map<String, String> getParams() {
            Map<String, String> params = new HashMap<String, String>();
            params.put(KEY_MAC_ADDRESS, macAddress);
            params.put(KEY_USERNAME, usernameStr);

            params.put(KEY_PHONENO, phoneNoStr);
            params.put(KEY_Address, addressStr);

            return params;


    RequestQueue requestQueue = Volley.newRequestQueue(this);

Any idea what I am missing that I am unable to store user data in database and my server is working fine its working good on localhost. Any help would be much appreciated thanks
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.