Click here to Skip to main content
13,766,769 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have developed a simple user login system with registration.
i have referred few websites for developed that?
but i can't identify the issue properly?

this is the error i've got?
after i compiled it and when i type daa in textboxes,
it will show below error?

W/IInputConnectionWrapper: finishComposingText on inactive InputConnection

these are other errors i'm getting?

W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
W/System.err: at org.json.JSON.typeMismatch(
W/System.err: at org.json.JSONObject.<init>(
W/System.err: at org.json.JSONObject.<init>(
W/System.err: at com.hemas.virtualfoods.RegisterActivity$1$1.onResponse(
com.hemas.virtualfoods W/System.err: at com.hemas.virtualfoods.RegisterActivity$1$1.onResponse(
com.hemas.virtualfoods W/System.err: at
com.hemas.virtualfoods W/System.err: at
com.hemas.virtualfoods W/System.err: at$
com.hemas.virtualfoods W/System.err: at android.os.Handler.handleCallback(
com.hemas.virtualfoods W/System.err: at android.os.Handler.dispatchMessage(
com.hemas.virtualfoods W/System.err: at android.os.Looper.loop(
com.hemas.virtualfoods W/System.err: at
com.hemas.virtualfoods W/System.err: at java.lang.reflect.Method.invoke(Native Method)
com.hemas.virtualfoods W/System.err: at$
com.hemas.virtualfoods W/System.err: at

What I have tried:

package com.hemas.virtualfoods;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


import org.json.JSONException;
import org.json.JSONObject;

public class RegisterActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {
        final EditText regName = (EditText)findViewById(;
        final EditText regPassword = (EditText)findViewById(;
        //final EditText regConfirmPass = (EditText) findViewById(;
        final EditText regPhone = (EditText)findViewById(;
        final EditText regEmail = (EditText)findViewById(;

        final Button regButton = (Button)findViewById(;

        regButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

                final String username = regName.getText().toString();
                final String password = regPassword.getText().toString();
                final String phoneno = regPhone.getText().toString();
                final String email = regEmail.getText().toString();

                Response.Listener<String> responseListener = new Response.Listener<String>() {

                    public void onResponse(String response) {
                        try {
                          //  JSONObject jsonResponse = (JSONObject) new JSONTokener(response).nextValue();
                           JSONObject jsonResponse = new JSONObject(response);
                            boolean success = (1 == jsonResponse.getInt("success"));

                            if (success) {
                                Intent intent = getIntent();
                                intent.setClass(getBaseContext(), LoginActivity.class);

                                //Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
                            } else {
                                AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
                                builder.setMessage("Register Failed")
                                        .setNegativeButton("Retry", null)

                        } catch (JSONException e) {


                RegisterRequest registerRequest = new RegisterRequest(username, password, phoneno, email, responseListener);
                RequestQueue queue = Volley.newRequestQueue(RegisterActivity.this);

package com.hemas.virtualfoods;


import java.util.HashMap;
import java.util.Map;

public class RegisterRequest extends StringRequest {

private static final String REGISTER_REQUEST_URL = "";
private Map<String, String> params;

public RegisterRequest(String username, String password, String phoneno, String email, Response.Listener<String> listener){
        super(Method.POST, REGISTER_REQUEST_URL, listener, null);
        params = new HashMap<>();
        params.put("username", username);
        params.put("password", password);
        params.put("phoneno", phoneno);
        params.put("email", email);

public Map<String, String> getParams() {
        return params;
Posted 18-Aug-17 8:43am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.181114.1 | Last Updated 18 Aug 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100