1. Download our Official Android App: Forums for Android!

Apps Android Register form not working but data goes into database

Discussion in 'Android Development' started by maddie_jones, Mar 17, 2016.

  1. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    I am trying to implement an android register form which is not working as when users try to register the application just crashes and closes, however, users information does get inserted into the database.

    My question is that why does it close down as the data does get inserted into the database successfully. Please advise and help.

    Log cat error Message

    Code (Text):
    1.   {"tag":"register","success":1,"error":0,"user":{"fname":"crisnfg","lname":"nawadv","email":"christina@gmail.com","uname":"crisitina","uid":"56e99196d80403.95127534","created_at":"2016-03-16 17:02:14"}}
    2.     03-16 17:01:48.945 8482-11204/com.bradvisor.bradvisor E/Buffer Error: Error converting result org.json.JSONException: Value 2016-03-16 of type java.lang.String cannot be converted to JSONObject
    3.     03-16 17:01:48.948 8482-8482/com.empier E/AndroidRuntime: FATAL EXCEPTION: main
    4.                                                                            Process: com.empier, PID: 8482
    5.                                                                            java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.getString(java.lang.String)' on a null object reference
    6.                                                                                at com.empier.Register$ProcessRegister.onPostExecute(Register.java:209)
    7.                                                                                at com.empier.Register$ProcessRegister.onPostExecute(Register.java:169)
    8.  
    9.  
    10.     03-16 19:34:03.519 19048-19048/com.empier D/debug_tag: false
    11.     03-16 19:34:10.110 19048-19048/com.empier D/debug_tag: false
    12.     03-16 19:34:10.198 19048-19048/com.empier D/debug_tag: false
    13.     03-16 19:35:42.417 19048-19048/com.empier D/debug_tag: false
    14.     03-16 19:35:43.093 19048-19048/com.empier D/debug_tag: false
    15.     03-16 19:37:07.778 19048-19048/com.empier D/debug_tag: false
    16.     03-16 19:38:22.195 19048-19048/com.empier D/debug_tag: false
    17.     03-16 19:40:23.161 19048-19048/com.empier D/debug_tag: false
    18.     03-16 19:42:56.833 24951-24951/com.empier D/debug_tag: true
    19.     03-16 19:58:16.518 29411-29411/? D/debug_tag: true
    20.  
    Register.Java Code



    Code (Text):
    1. public class Register extends Activity {
    2.  
    3.  
    4.         /**
    5.          *  JSON Response node names.
    6.          **/
    7.  
    8.  
    9.         private static String KEY_SUCCESS = "success";
    10.         private static String KEY_UID = "uid";
    11.         private static String KEY_FIRSTNAME = "fname";
    12.         private static String KEY_LASTNAME = "lname";
    13.         private static String KEY_USERNAME = "uname";
    14.         private static String KEY_EMAIL = "email";
    15.         private static String KEY_CREATED_AT = "created_at";
    16.         private static String KEY_ERROR = "error";
    17.  
    18.         /**
    19.          * Defining layout items.
    20.          **/
    21.  
    22.         EditText inputFirstName;
    23.         EditText inputLastName;
    24.         EditText inputUsername;
    25.         EditText inputEmail;
    26.         EditText inputPassword;
    27.         ImageButton btnRegister;
    28.         TextView registerErrorMsg;
    29.  
    30.  
    31.         /**
    32.          * Called when the activity is first created.
    33.          */
    34.         @Override
    35.         public void onCreate(Bundle savedInstanceState) {
    36.             super.onCreate(savedInstanceState);
    37.             setContentView(R.layout.register);
    38.  
    39.             /**
    40.              * Defining all layout items
    41.              **/
    42.             inputFirstName = (EditText) findViewById(R.id.fname);
    43.             inputLastName = (EditText) findViewById(R.id.lname);
    44.             inputUsername = (EditText) findViewById(R.id.uname);
    45.             inputEmail = (EditText) findViewById(R.id.email);
    46.             inputPassword = (EditText) findViewById(R.id.pword);
    47.             btnRegister = (ImageButton) findViewById(R.id.Registerbtn);
    48.             registerErrorMsg = (TextView) findViewById(R.id.register_error);
    49.  
    50.             /**
    51.              * Register Button click event.
    52.              * A Toast is set to alert when the fields are empty.
    53.              * Another toast is set to alert Username must be 5 characters.
    54.              **/
    55.  
    56.             btnRegister.setOnClickListener(new View.OnClickListener() {
    57.                 @Override
    58.                 public void onClick(View view) {
    59.  
    60.                     if (  ( !inputUsername.getText().toString().equals("")) && ( !inputPassword.getText().toString().equals("")) && ( !inputFirstName.getText().toString().equals("")) && ( !inputLastName.getText().toString().equals("")) && ( !inputEmail.getText().toString().equals("")) )
    61.                     {
    62.                         if ( inputUsername.getText().toString().length() > 4 ){
    63.                             NetAsync(view);
    64.  
    65.                         }
    66.                         else
    67.                         {
    68.                             Toast.makeText(getApplicationContext(),
    69.                                     "Username should be minimum 5 characters", Toast.LENGTH_SHORT).show();
    70.                         }
    71.                     }
    72.                     else
    73.                     {
    74.                         Toast.makeText(getApplicationContext(),
    75.                                 "One or more fields are empty", Toast.LENGTH_SHORT).show();
    76.                     }
    77.                 }
    78.             });
    79.         }
    80.         /**
    81.          * Async Task to check whether internet connection is working
    82.          **/
    83.  
    84.         private class NetCheck extends AsyncTask<String,String,Boolean>
    85.         {
    86.             private ProgressDialog nDialog;
    87.  
    88.             @Override
    89.             protected void onPreExecute(){
    90.                 super.onPreExecute();
    91.                 nDialog = new ProgressDialog(Register.this);
    92.                 nDialog.setMessage("Loading..");
    93.                 nDialog.setTitle("Checking Network");
    94.                 nDialog.setIndeterminate(false);
    95.                 nDialog.setCancelable(true);
    96.                 nDialog.show();
    97.             }
    98.  
    99.             @Override
    100.             protected Boolean doInBackground(String... args){
    101.  
    102.  
    103.     /**
    104.      * Gets current device state and checks for working internet connection by trying Google.
    105.      **/
    106.                 ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    107.                 NetworkInfo netInfo = cm.getActiveNetworkInfo();
    108.                 if (netInfo != null && netInfo.isConnected()) {
    109.                     try {
    110.                         URL url = new URL("http://www.google.com");
    111.                         HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
    112.                         urlc.setConnectTimeout(3000);
    113.                         urlc.connect();
    114.                         if (urlc.getResponseCode() == 200) {
    115.                             return true;
    116.                         }
    117.                     } catch (MalformedURLException e1) {
    118.                         // TODO Auto-generated catch block
    119.                         e1.printStackTrace();
    120.                     } catch (IOException e) {
    121.                         // TODO Auto-generated catch block
    122.                         e.printStackTrace();
    123.                     }
    124.                 }
    125.                 return false;
    126.  
    127.             }
    128.             @Override
    129.             protected void onPostExecute(Boolean th){
    130.  
    131.                 if(th == true){
    132.                     nDialog.dismiss();
    133.                     new ProcessRegister().execute();
    134.                 }
    135.                 else{
    136.                     nDialog.dismiss();
    137.                     registerErrorMsg.setText("Error in Network Connection");
    138.                 }
    139.             }
    140.         }
    141.  
    142.  
    143.         private class ProcessRegister extends AsyncTask<String, String, JSONObject> {
    144.  
    145.             /**
    146.              * Defining Process dialog
    147.              **/
    148.             private ProgressDialog pDialog;
    149.  
    150.             String email,password,fname,lname,uname;
    151.             @Override
    152.             protected void onPreExecute() {
    153.                 super.onPreExecute();
    154.                 inputUsername = (EditText) findViewById(R.id.uname);
    155.                 inputPassword = (EditText) findViewById(R.id.pword);
    156.                 fname = inputFirstName.getText().toString();
    157.                 lname = inputLastName.getText().toString();
    158.                 email = inputEmail.getText().toString();
    159.                 uname= inputUsername.getText().toString();
    160.                 password = inputPassword.getText().toString();
    161.                 pDialog = new ProgressDialog(Register.this);
    162.                 pDialog.setTitle("Contacting Servers");
    163.                 pDialog.setMessage("Registering ...");
    164.                 pDialog.setIndeterminate(false);
    165.                 pDialog.setCancelable(true);
    166.                 pDialog.show();
    167.             }
    168.  
    169.             @Override
    170.             protected JSONObject doInBackground(String... args) {
    171.  
    172.  
    173.                 UserFunctions userFunction = new UserFunctions();
    174.                 JSONObject json = userFunction.registerUser(fname, lname, email, uname, password);
    175.  
    176.                 return json;
    177.  
    178.  
    179.             }
    180.             @Override
    181.             protected void onPostExecute(JSONObject json) { Log.d("debug_tag", json == null ? "true" : "false");
    182.                 try {
    183.                     if (json.getString(KEY_SUCCESS) != null) {
    184.  
    185.                         registerErrorMsg.setText("");
    186.                         String res = json.getString(KEY_SUCCESS);
    187.  
    188.                         String red = json.getString(KEY_ERROR);
    189.  
    190.                         if(Integer.parseInt(res) == 1){
    191.                             pDialog.setTitle("Getting Data");
    192.                             pDialog.setMessage("Loading Info");
    193.  
    194.                             registerErrorMsg.setText("Successfully Registered");
    195.  
    196.  
    197.                             DatabaseHandler db = new DatabaseHandler(getApplicationContext());
    198.                             JSONObject json_user = json.getJSONObject("user"); Log.d("debug_tag", "User json :: " + json_user==null ? "true": "false");
    199.  
    200.                             /**
    201.                              * Removes all the previous data in the SQlite database
    202.                              **/
    203.  
    204.                             UserFunctions logout = new UserFunctions();
    205.                             logout.logoutUser(getApplicationContext());
    206.                             db.addUser(json_user.getString(KEY_FIRSTNAME),json_user.getString(KEY_LASTNAME),json_user.getString(KEY_EMAIL),json_user.getString(KEY_USERNAME),json_user.getString(KEY_UID),json_user.getString(KEY_CREATED_AT));
    207.                             /**
    208.                              * Stores registered data in SQlite Database
    209.                              * Launch Registered screen
    210.                              **/
    211.  
    212.                             Intent registered = new Intent(getApplicationContext(), Registered.class);
    213.  
    214.                             /**
    215.                              * Close all views before launching Registered screen
    216.                              **/
    217.                             registered.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    218.                             pDialog.dismiss();
    219.                             startActivity(registered);
    220.  
    221.  
    222.                             finish();
    223.                         }
    224.  
    225.                         else if (Integer.parseInt(red) ==2){
    226.                             pDialog.dismiss();
    227.                             registerErrorMsg.setText("User already exists");
    228.                         }
    229.                         else if (Integer.parseInt(red) ==3){
    230.                             pDialog.dismiss();
    231.                             registerErrorMsg.setText("Invalid Email id");
    232.                         }
    233.  
    234.                     }
    235.  
    236.  
    237.                     else{
    238.                         pDialog.dismiss();
    239.  
    240.                         registerErrorMsg.setText("Error occurred in registration");
    241.                     }
    242.  
    243.                 } catch (JSONException e) {
    244.                     e.printStackTrace();
    245.                 }
    246.             }}
    247.         public void NetAsync(View view){
    248.             new NetCheck().execute();
    249.         }}
    250.  
    251. Userfunction.java code
    252.  
    253. [CODE]
    254.    /**
    255.          * Function to  Register
    256.          **/
    257.         public JSONObject registerUser(String fname, String lname, String email, String uname, String password){
    258.             // Building Parameters
    259.             List params = new ArrayList();
    260.             params.add(new BasicNameValuePair("tag", register_tag));
    261.             params.add(new BasicNameValuePair("fname", fname));
    262.             params.add(new BasicNameValuePair("lname", lname));
    263.             params.add(new BasicNameValuePair("email", email));
    264.             params.add(new BasicNameValuePair("uname", uname));
    265.             params.add(new BasicNameValuePair("password", password));
    266.             JSONObject json = jsonParser.getJSONFromUrl(registerURL, params);
    267.             return json;
    268.  
    269.         }
    270.  
    271.  
    Registered.java file

    Code (Text):
    1.  
    2.     public class Registered extends Activity {
    3.  
    4.  
    5.  
    6.         /**
    7.          * Called when the activity is first created.
    8.          */
    9.         @Override
    10.         public void onCreate(Bundle savedInstanceState) {
    11.             super.onCreate(savedInstanceState);
    12.             setContentView(R.layout.registered);
    13.  
    14.  
    15.             DatabaseHandler db = new DatabaseHandler(getApplicationContext());
    16.  
    17.             HashMap<String,String> user = new HashMap<String, String>();
    18.             user = db.getUserDetails();
    19.  
    20.             /**
    21.              * Displays the registration details in Text view
    22.              **/
    23.  
    24.             final TextView fname = (TextView)findViewById(R.id.fname);
    25.             final TextView lname = (TextView)findViewById(R.id.lname);
    26.             final TextView uname = (TextView)findViewById(R.id.uname);
    27.             final TextView email = (TextView)findViewById(R.id.email);
    28.             final TextView created_at = (TextView)findViewById(R.id.regat);
    29.             fname.setText(user.get("fname"));
    30.             lname.setText(user.get("lname"));
    31.             uname.setText(user.get("uname"));
    32.             email.setText(user.get("email"));
    33.             created_at.setText(user.get("created_at"));
    34.  
    35.  
    36.             ImageButton loginbtn = (ImageButton) findViewById(R.id.loginscreenbtn);
    37.             loginbtn.setOnClickListener(new View.OnClickListener() {
    38.                 public void onClick(View view) {
    39.                     Intent myIntent = new Intent(view.getContext(), Login.class);
    40.                     startActivityForResult(myIntent, 0);
    41.                     finish();
    42.                 }
    43.  
    44.             });
    45.  
    46.         }}
    47.  
    48.  

    Register.XML File


    Code (Text):
    1.  
    2.  
    3.     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    4.         tools:context="bradvisor.bradvisor.com.bradvisor.LoginActivity"
    5.         android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    6.         xmlns:tools="http://schemas.android.com/tools"
    7.         android:layout_width="match_parent"
    8.         android:layout_height="match_parent"
    9.         android:paddingLeft="@dimen/activity_horizontal_margin"
    10.         android:paddingRight="@dimen/activity_horizontal_margin"
    11.         android:paddingTop="@dimen/activity_vertical_margin"
    12.         android:paddingBottom="@dimen/activity_vertical_margin"
    13.         android:background="#ffffffff"
    14.         android:layout_alignParentTop="true"
    15.         android:layout_alignParentLeft="true"
    16.         android:layout_alignParentStart="true">
    17.  
    18.         <ImageView
    19.             android:layout_width="match_parent"
    20.             android:layout_height="150dp"
    21.             android:id="@+id/imageView5"
    22.             android:layout_gravity="center_horizontal|top"
    23.             android:src="@drawable/logofinal"
    24.             android:layout_alignParentLeft="true"
    25.             android:layout_alignParentStart="true"
    26.             android:layout_alignParentTop="true"
    27.             android:layout_alignParentRight="true"
    28.             android:layout_alignParentEnd="true" />
    29.  
    30.         <ImageButton
    31.             android:layout_width="fill_parent"
    32.             android:layout_height="wrap_content"
    33.             android:id="@+id/Registerbtn"
    34.             android:src="@drawable/registerbtn"
    35.             android:background="#00000000"
    36.             android:layout_below="@+id/pword"
    37.             android:layout_alignParentLeft="true"
    38.             android:layout_alignParentStart="true" />
    39.  
    40.         <EditText
    41.             android:layout_width="fill_parent"
    42.             android:layout_height="wrap_content"
    43.             android:inputType="textPersonName"
    44.             android:text="First Name"
    45.             android:ems="10"
    46.             android:id="@+id/fname"
    47.             android:textColor="#ff3b5998"
    48.             android:layout_below="@+id/imageView5"
    49.             android:layout_alignParentLeft="true"
    50.             android:layout_alignParentStart="true"
    51.             android:singleLine="false" />
    52.  
    53.         <EditText
    54.             android:layout_width="fill_parent"
    55.             android:layout_height="wrap_content"
    56.             android:inputType="textPersonName"
    57.             android:text="Last Name"
    58.             android:ems="10"
    59.             android:id="@+id/lname"
    60.             android:layout_below="@+id/fname"
    61.             android:layout_alignParentRight="true"
    62.             android:layout_alignParentEnd="true"
    63.             android:textColor="#3b5998" />
    64.  
    65.         <EditText
    66.             android:layout_width="fill_parent"
    67.             android:layout_height="wrap_content"
    68.             android:ems="10"
    69.             android:id="@+id/uname"
    70.             android:textSize="20dp"
    71.             android:layout_below="@+id/lname"
    72.             android:layout_alignParentLeft="true"
    73.             android:text="Username"
    74.             android:textColor="#3b5998"
    75.             android:inputType="textPersonName" />
    76.  
    77.         <EditText
    78.             android:layout_width="fill_parent"
    79.             android:layout_height="wrap_content"
    80.             android:inputType="textEmailAddress"
    81.             android:ems="10"
    82.             android:id="@+id/email"
    83.             android:layout_below="@+id/uname"
    84.             android:layout_centerHorizontal="true"
    85.             android:text="Email"
    86.             android:textColor="#3b5998" />
    87.  
    88.         <EditText
    89.             android:layout_width="fill_parent"
    90.             android:layout_height="wrap_content"
    91.             android:inputType="textPassword"
    92.             android:ems="10"
    93.             android:id="@+id/pword"
    94.             android:layout_below="@+id/email"
    95.             android:layout_alignParentLeft="true"
    96.             android:layout_alignParentStart="true"
    97.             android:text="Password"
    98.             android:textColor="#3b5998" />
    99.         <TextView
    100.             android:layout_width="fill_parent"
    101.             android:layout_height="56dp"
    102.             android:textColor="#3b5998"
    103.             android:id="@+id/register_error"
    104.             android:layout_below="@+id/Registerbtn"
    105.             android:layout_alignParentLeft="true"
    106.             android:layout_alignParentStart="true"
    107.             android:layout_marginTop="30dp" />
    108.     </RelativeLayout>
    109.  
    110.  
    registered.xml

    Code (Text):
    1.  
    2.  
    3.     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    4.         tools:context="bradvisor.bradvisor.com.bradvisor.LoginActivity"
    5.         android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    6.         xmlns:tools="http://schemas.android.com/tools"
    7.         android:layout_width="match_parent"
    8.         android:layout_height="match_parent"
    9.         android:paddingLeft="@dimen/activity_horizontal_margin"
    10.         android:paddingRight="@dimen/activity_horizontal_margin"
    11.         android:paddingTop="@dimen/activity_vertical_margin"
    12.         android:paddingBottom="@dimen/activity_vertical_margin"
    13.         android:background="#ffffffff"
    14.         android:layout_alignParentTop="true"
    15.         android:layout_alignParentLeft="true"
    16.         android:layout_alignParentStart="true">
    17.  
    18.         <ImageView
    19.             android:layout_width="match_parent"
    20.             android:layout_height="150dp"
    21.             android:id="@+id/imageView5"
    22.             android:layout_gravity="center_horizontal|top"
    23.             android:src="@drawable/logofinal"
    24.             android:layout_alignParentLeft="true"
    25.             android:layout_alignParentStart="true"
    26.             android:layout_alignParentTop="true"
    27.             android:layout_alignParentRight="true"
    28.             android:layout_alignParentEnd="true" />
    29.  
    30.         <ImageButton
    31.             android:layout_width="fill_parent"
    32.             android:layout_height="wrap_content"
    33.             android:id="@+id/Registerbtn"
    34.             android:src="@drawable/registerbtn"
    35.             android:background="#00000000"
    36.             android:layout_below="@+id/pword"
    37.             android:layout_alignParentLeft="true"
    38.             android:layout_alignParentStart="true" />
    39.  
    40.         <EditText
    41.             android:layout_width="fill_parent"
    42.             android:layout_height="wrap_content"
    43.             android:inputType="textPersonName"
    44.             android:text="First Name"
    45.             android:ems="10"
    46.             android:id="@+id/fname"
    47.             android:textColor="#ff3b5998"
    48.             android:layout_below="@+id/imageView5"
    49.             android:layout_alignParentLeft="true"
    50.             android:layout_alignParentStart="true"
    51.             android:singleLine="false" />
    52.  
    53.         <EditText
    54.             android:layout_width="fill_parent"
    55.             android:layout_height="wrap_content"
    56.             android:inputType="textPersonName"
    57.             android:text="Last Name"
    58.             android:ems="10"
    59.             android:id="@+id/lname"
    60.             android:layout_below="@+id/fname"
    61.             android:layout_alignParentRight="true"
    62.             android:layout_alignParentEnd="true"
    63.             android:textColor="#3b5998" />
    64.  
    65.         <EditText
    66.             android:layout_width="fill_parent"
    67.             android:layout_height="wrap_content"
    68.             android:ems="10"
    69.             android:id="@+id/uname"
    70.             android:textSize="20dp"
    71.             android:layout_below="@+id/lname"
    72.             android:layout_alignParentLeft="true"
    73.             android:text="Username"
    74.             android:textColor="#3b5998"
    75.             android:inputType="textPersonName" />
    76.  
    77.         <EditText
    78.             android:layout_width="fill_parent"
    79.             android:layout_height="wrap_content"
    80.             android:inputType="textEmailAddress"
    81.             android:ems="10"
    82.             android:id="@+id/email"
    83.             android:layout_below="@+id/uname"
    84.             android:layout_centerHorizontal="true"
    85.             android:text="Email"
    86.             android:textColor="#3b5998" />
    87.  
    88.         <EditText
    89.             android:layout_width="fill_parent"
    90.             android:layout_height="wrap_content"
    91.             android:inputType="textPassword"
    92.             android:ems="10"
    93.             android:id="@+id/pword"
    94.             android:layout_below="@+id/email"
    95.             android:layout_alignParentLeft="true"
    96.             android:layout_alignParentStart="true"
    97.             android:text="Password"
    98.             android:textColor="#3b5998" />
    99.         <TextView
    100.             android:layout_width="fill_parent"
    101.             android:layout_height="56dp"
    102.             android:textColor="#3b5998"
    103.             android:id="@+id/register_error"
    104.             android:layout_below="@+id/Registerbtn"
    105.             android:layout_alignParentLeft="true"
    106.             android:layout_alignParentStart="true"
    107.             android:layout_marginTop="30dp" />
    108.     </RelativeLayout>
    109.  
    110.  
    When I debug the application I do not get anything as everything works fine. please help and advise?.

    The crash logs show that there is NullPointerException in onPostExecute() method. So either my json object which I am getting in onPostExecute() as a parameter is null or json_user in -

    Code (Text):
    1. JSONObject json_user = json.getJSONObject("user");
    is null. I have added two logs for these 2 objects and check for null to find out which of them are causing the issue. I am unsuccessful. Could you please help how I am able to find the error message and check where the null is coming from.
     

    Advertisement

    #1 maddie_jones, Mar 17, 2016
    Last edited: Mar 17, 2016
  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    Your problem is definitely that json_user is null at some point.

    I would set a breakpoint at this line

    Code (Text):
    1.  
    2. JSONObject json = jsonParser.getJSONFromUrl(registerURL, params);          
    3.  
    and examine the returned json object, because for one of your param sets, you get a JSON data structure which does not contain element "user".
     
  3. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    I have added the break point and debugged the application, however I can see that json is returning a new null value. Please see the below results.

    Code (Text):
    1.  
    2. this = {UserFunctions@831721419648}
    3. jsonParser = {JSONParser@831721420368}
    4. json = null
    5. params = {ArrayList@831721420384}  size = 6
    6. 0 = {BasicNameValuePair@831721420544} "tag=register"
    7.   value = {String@831721419456} "register"
    8.   name = {String@831694602352} "tag"
    9. 1 = {BasicNameValuePair@831721420688} "fname=lawson"
    10.   name = {String@831697794824} "fname"
    11.   value = {String@831721366152} "lawson"
    12. 2 = {BasicNameValuePair@831721420712} "lname=Junior"
    13.   name = {String@831697794888} "lname"
    14.   value = {String@831721366248} "Junior"
    15. 3 = {BasicNameValuePair@831721420736} "email=lawson123@ymaill.com"
    16.   name = {String@831697795120} "email"
    17.   value = {String@831721366368} "lawson123@ymaill.com"
    18. 4 = {BasicNameValuePair@831721420760} "uname=junior_l"
    19.   name = {String@831697795056} "uname"
    20.   value = {String@831721366488} "junior_l"
    21. 5 = {BasicNameValuePair@831721420784} "password=Lampard8"
    22.   name = {String@831694110784} "password"
    23.   value = {String@831721366584} "Lampard8"
    24.  
    25. jsonParser = {JSONParser@831721420368}
    26. registerURL= {String@831721419264} "http://192.168.85.1/bradvisor_login_api/"
    27.  
    28.  
    Please advise or help, what shall I do next.
     
    #3 maddie_jones, Mar 18, 2016
    Last edited: Mar 18, 2016
  4. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    Ok so you have established that the server is returning null for this set of input params. Can you determine why that happened? Are you able to debug the server? Presumably it's inserting this data into a database and returning the result back to you. Is there some problem with the database insertion?
     
  5. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    No, the data does get inserted into the database. How can I debug the server. I do not think that is a problem as login, change password and reset password are working all fine.
     
    #5 maddie_jones, Mar 18, 2016
    Last edited: Mar 18, 2016
  6. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    Why is your web service returning null?
     
  7. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    If I use localhost then it will not return null. I am using wamp server as local host.
     
  8. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    So in the case null is returned, why is this happening?
     
  9. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    Let me amend the phpmyadmin.conf file to allow it access from all ipaddress to see if this will make a difference. I do not understand as the login, change and reset password works without giving any null values. I am using the same server address for register. Its weird.
     
  10. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    I have checked it again and this time it is not returning null. Please advice?.
    Code (Text):
    1.  
    2. this = {UserFunctions@831721408496}
    3.  jsonParser = {JSONParser@831721409216}
    4.  
    5. params = {ArrayList@831721409232}  size = 6
    6.  0 = {BasicNameValuePair@831721409392} "tag=register"
    7.   name = {String@831694577584} "tag"
    8.   value = {String@831721408304} "register"
    9.  1 = {BasicNameValuePair@831721409536} "fname=This"
    10.   name = {String@831697796640} "fname"
    11.   value = {String@831721349768} "This"
    12.  2 = {BasicNameValuePair@831721409560} "lname=Monring"
    13.   name = {String@831697796704} "lname"
    14.   value = {String@831721349856} "Monring"
    15.  3 = {BasicNameValuePair@831721409584} "email=thismorning@gmail.com"
    16.   name = {String@831697796936} "email"
    17.   value = {String@831721349984} "thismorning@gmail.com"
    18.  4 = {BasicNameValuePair@831721409608} "uname=thismorning"
    19.   name = {String@831697796872} "uname"
    20.   value = {String@831721350120} "thismorning"
    21.  5 = {BasicNameValuePair@831721409632} "password=Ruth1234"
    22.   name = {String@831694135360} "password"
    23.   value = {String@831721350224} "Ruth1234"
    24. jsonParser = {JSONParser@831721409216}
    25.  
    26. registerURL= {String@831721409216} "http://192.168.85.1/bradvisor_login_api/"
    27.  
    28.  
     
  11. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    Ok let's rewind a bit.
    Your basic problem is that variable json_user is null:

    Code (Text):
    1.  
    2. JSONObject json_user = json.getJSONObject("user")
    3.  
    This did actually happen because the stack trace in your first post proves it.

    From this we can say for sure that the JSON data structure returned from your web service did not contain the element "user"

    To determine when this occurs, I suggest putting a breakpoint at this line of code

    Code (Text):
    1.  
    2. JSONObject json = jsonParser.getJSONFromUrl(registerURL, params);
    3.  
    Which will stop every time you get to that point. You can then look at the values of your parameters *and* the returned JSON data structure. This will tell you under what circumstances the web service returns the incomplete JSON data.

    But as I said before, you will have to do some analysis of the server code to work out why incorrect data is being returned.

    And it's no good simply sprinkling your code with Log statements. The best way to track this down is using breakpoints and looking at the variable values in the debugger.

    I cannot give any clearer advice than this.
     
  12. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    I have put a break point on this line, shall I wait for the break point to stop or do I need to step into it.
     
  13. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    Actually, set the breakpoint here if you can

    Code (Text):
    1.  
    2. return json;
    3.  
    What you are wanting to do is look at the value of variable 'json' after the call to the web request returns. Ok?
     
  14. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    After putting the break point in, I can now see that the value is returning null.

    Code (Text):
    1.  
    2. userFunction = {UserFunctions@831722144728}
    3.  jsonParser = {JSONParser@831722145448}
    4.  json= null
    5.  lname = {String@831722145448} "jones"
    6.  email = {String@831722145448} "vincejames@yahoo.com"
    7.  uname = {String@831722145448} "JonesVince"
    8.  password = {String@831722145448} "Lion123456"
    9.  fname = {String@831722145448} "Vince"
    10.  
    11.  
    Could you please advice what shall I can do to fix this issue so that json returns a value instead of null.
     
  15. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    Maybe if you show details of what is on the server side of this
     
  16. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    I have added my databasehandler.java file.

    Code (Text):
    1.  
    2. public class DatabaseHandler extends SQLiteOpenHelper {
    3.  
    4.     // All Static variables
    5.     // Database Version
    6.     private static final int DATABASE_VERSION = 1;
    7.  
    8.     // Database Name
    9.     private static final String DATABASE_NAME = "bradvisor_login_api";
    10.  
    11.     // Login table name
    12.     private static final String TABLE_LOGIN = "users";
    13.  
    14.  
    15.  
    16.  
    17.     // Login Table Columns names
    18.     private static final String KEY_ID = "id";
    19.     private static final String KEY_FIRSTNAME = "fname";
    20.     private static final String KEY_LASTNAME = "lname";
    21.     private static final String KEY_EMAIL = "email";
    22.     private static final String KEY_USERNAME = "uname";
    23.     private static final String KEY_UID = "uid";
    24.     private static final String KEY_CREATED_AT = "created_at";
    25.  
    26.     public DatabaseHandler(Context context) {
    27.         super(context, DATABASE_NAME, null, DATABASE_VERSION);
    28.     }
    29.  
    30.     // Creating Tables
    31.     @Override
    32.     public void onCreate(SQLiteDatabase db) {
    33.         String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_LOGIN + "("
    34.                 + KEY_ID + " INTEGER PRIMARY KEY,"
    35.                 + KEY_FIRSTNAME + " TEXT,"
    36.                 + KEY_LASTNAME + " TEXT,"
    37.                 + KEY_EMAIL + " TEXT UNIQUE,"
    38.                 + KEY_USERNAME + " TEXT,"
    39.                 + KEY_UID + " TEXT,"
    40.                 + KEY_CREATED_AT + " TEXT" + ")";
    41.         db.execSQL(CREATE_LOGIN_TABLE);
    42.     }
    43.  
    44.     // Upgrading database
    45.     @Override
    46.     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    47.         // Drop older table if existed
    48.         db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOGIN);
    49.  
    50.         // Create tables again
    51.         onCreate(db);
    52.     }
    53.  
    54.     /**
    55.      * Storing user details in database
    56.      * */
    57.     public void addUser(String fname, String lname, String email, String uname, String uid, String created_at) {
    58.         SQLiteDatabase db = this.getWritableDatabase();
    59.  
    60.         ContentValues values = new ContentValues();
    61.         values.put(KEY_FIRSTNAME, fname); // FirstName
    62.         values.put(KEY_LASTNAME, lname); // LastName
    63.         values.put(KEY_EMAIL, email); // Email
    64.         values.put(KEY_USERNAME, uname); // UserName
    65.         values.put(KEY_UID, uid); // Email
    66.         values.put(KEY_CREATED_AT, created_at); // Created At
    67.  
    68.         // Inserting Row
    69.         db.insert(TABLE_LOGIN, null, values);
    70.         db.close(); // Closing database connection
    71.     }
    72.  
    73.  
    74.     /**
    75.      * Getting user data from database
    76.      * */
    77.     public HashMap<String, String> getUserDetails(){
    78.         HashMap<String,String> user = new HashMap<String,String>();
    79.         String selectQuery = "SELECT  * FROM " + TABLE_LOGIN;
    80.  
    81.         SQLiteDatabase db = this.getReadableDatabase();
    82.         Cursor cursor = db.rawQuery(selectQuery, null);
    83.         // Move to first row
    84.         cursor.moveToFirst();
    85.         if(cursor.getCount() > 0){
    86.             user.put("fname", cursor.getString(1));
    87.             user.put("lname", cursor.getString(2));
    88.             user.put("email", cursor.getString(3));
    89.             user.put("uname", cursor.getString(4));
    90.             user.put("uid", cursor.getString(5));
    91.             user.put("created_at", cursor.getString(6));
    92.         }
    93.         cursor.close();
    94.         db.close();
    95.         // return user
    96.         return user;
    97.     }
    98.  
    99.  
    100.  
    101.  
    102.  
    103.  
    104.     /**
    105.      * Getting user login status
    106.      * return true if rows are there in table
    107.      * */
    108.     public int getRowCount() {
    109.         String countQuery = "SELECT  * FROM " + TABLE_LOGIN;
    110.         SQLiteDatabase db = this.getReadableDatabase();
    111.         Cursor cursor = db.rawQuery(countQuery, null);
    112.         int rowCount = cursor.getCount();
    113.         db.close();
    114.         cursor.close();
    115.  
    116.         // return row count
    117.         return rowCount;
    118.     }
    119.  
    120.  
    121.     /**
    122.      * Re crate database
    123.      * Delete all tables and create them again
    124.      * */
    125.     public void resetTables(){
    126.         SQLiteDatabase db = this.getWritableDatabase();
    127.         // Delete All Rows
    128.         db.delete(TABLE_LOGIN, null, null);
    129.         db.close();
    130.     }
    131.  
    132. }
    133.  
    134.  
    Index.php

    Code (Text):
    1.  
    2. <?php
    3.  
    4. /*
    5.  PHP API for Login, Register, Changepassword, Resetpassword Requests and for Email Notifications.
    6.  */
    7.  
    8. require_once 'mailer.php';
    9.  
    10. if (isset($_POST['tag']) && $_POST['tag'] != '')
    11. {
    12.     // Include Database handler
    13.     require_once 'include/DB_Functions.php';
    14.     $db = new DB_Functions();
    15.    
    16.     // response Array
    17.     $response = array("tag" => $_POST['tag'], "success" => 0, "error" => 0);
    18.  
    19.     // check for tag type
    20.     switch($_POST['tag'])
    21.     {
    22.         case 'login':
    23.             // Request type is check Login
    24.             $email = $_POST['email'];
    25.             $password = $_POST['password'];
    26.      
    27.             // check for user
    28.             $user = $db->getUserByEmailAndPassword($email, $password);
    29.             if ($user != false)
    30.             {
    31.                 // user found
    32.                 // echo json with success = 1
    33.                 $response["success"] = 1;
    34.                 $response["user"]["fname"] = $user["firstname"];
    35.                 $response["user"]["lname"] = $user["lastname"];
    36.                 $response["user"]["email"] = $user["email"];
    37.                 $response["user"]["uname"] = $user["username"];
    38.                 $response["user"]["uid"] = $user["unique_id"];
    39.                 $response["user"]["created_at"] = $user["created_at"];
    40.             }
    41.             else
    42.             {
    43.                 // user not found
    44.                 // echo json with error = 1
    45.                 $response["error"] = 1;
    46.                 $response["error_msg"] = "Incorrect email or password!";
    47.             }
    48.         break;
    49.  
    50.         case 'chgpass':
    51.             $email = $_POST['email'];
    52.             $newpassword = $_POST['newpas'];
    53.  
    54.             $hash = $db->hashSSHA($newpassword);
    55.             $encrypted_password = $hash["encrypted"]; // encrypted password
    56.             $salt = $hash["salt"];
    57.  
    58.             if ($db->isUserExisted($email))
    59.             {
    60.                 $user = $db->forgotPassword($email, $encrypted_password, $salt);
    61.                 if ($user)
    62.                 {
    63.                     $response["success"] = 1;
    64.  
    65.                     $subject = "Change Password Notification";
    66.                     $message = "Hello $fname,\n\nYour Password is successfully changed.\n\nRegards,\nBradVisor Team.";
    67.                     send_email($subject, $message, $email);
    68.                 }
    69.                 else
    70.                 {
    71.                     $response["error"] = 1;
    72.                 }
    73.                 // user is already existed - error response
    74.             }
    75.             else
    76.             {
    77.                 $response["error"] = 2;
    78.                 $response["error_msg"] = "User not exist";
    79.             }
    80.         break;
    81.  
    82.         case 'forpass':
    83.             $email = $_POST['forgotpassword'];
    84.             $randomcode = $db->random_string();
    85.      
    86.             $hash = $db->hashSSHA($randomcode);
    87.             $encrypted_password = $hash["encrypted"]; // encrypted password
    88.             $salt = $hash["salt"];
    89.  
    90.             if ($db->isUserExisted($email))
    91.             {
    92.                 $user = $db->forgotPassword($email, $encrypted_password, $salt);
    93.                 if ($user)
    94.                 {
    95.                     $response["success"] = 1;
    96.  
    97.                     $subject = "Password Recovery";
    98.                     $message = "Hello $fname,\n\nYour Password is successfully changed. Your new Password is $randomcode . Login with your new Password and change it in the User Panel.\n\nRegards,\nBradVisor Team.";
    99.                     send_email($subject, $message, $email);
    100.                 }
    101.                 else
    102.                 {
    103.                     $response["error"] = 1;
    104.                 }
    105.                 // user is already existed - error response
    106.             }
    107.             else
    108.             {
    109.                 $response["error"] = 2;
    110.                 $response["error_msg"] = "User not exist";
    111.             }
    112.         break;
    113.  
    114.         case 'register':
    115.             // Request type is Register new user
    116.             $fname = $_POST['fname'];
    117.             $lname = $_POST['lname'];
    118.             $email = $_POST['email'];
    119.             $uname = $_POST['uname'];
    120.             $password = $_POST['password'];
    121.      
    122.             // check if user is already existed
    123.             if ($db->isUserExisted($email))
    124.             {
    125.                 // user is already existed - error response
    126.                 $response["error"] = 2;
    127.                 $response["error_msg"] = "User already existed";
    128.             }
    129.             else if(!$db->validEmail($email))
    130.             {
    131.                 $response["error"] = 3;
    132.                 $response["error_msg"] = "Invalid Email Id";          
    133.             }
    134.             else
    135.             {
    136.                 // store user
    137.                 $user = $db->storeUser($fname, $lname, $email, $uname, $password);
    138.                 if ($user)
    139.                 {
    140.                     // user stored successfully
    141.                     $response["success"] = 1;
    142.                     $response["user"]["fname"] = $user["firstname"];
    143.                     $response["user"]["lname"] = $user["lastname"];
    144.                     $response["user"]["email"] = $user["email"];
    145.                     $response["user"]["uname"] = $user["username"];
    146.                     $response["user"]["uid"] = $user["unique_id"];
    147.                     $response["user"]["created_at"] = $user["created_at"];
    148.  
    149.                     $subject = "Registration";
    150.                     $message = "Hello $fname,\n\nYou have successfully registered to our service.\n\nRegards,\nAdmin.";
    151.  
    152.                     $name = $user['firstname'] . ' ' . $user['lastname'];
    153.                     send_email($subject, $message, $email, $name);
    154.                 }
    155.                 else
    156.                 {
    157.                     // user failed to store
    158.                     $response["error"] = 1;
    159.                     $response["error_msg"] = "JSON Error occured in Registartion";
    160.                 }
    161.             }
    162.         break;
    163.  
    164.         default:
    165.             $response["error"] = 3;
    166.             $response["error_msg"] = "JSON ERROR";
    167.     }
    168.  
    169.     echo json_encode($response);
    170. }
    171. else
    172. {
    173.     echo "BradVisor Login API";
    174. }
    175. ?>
    176.  
    userfunction.php

    Code (Text):
    1.  
    2. /**
    3.      * Adding new user to mysqli database
    4.      * returns user details
    5.      */
    6.  
    7.     public function storeUser($fname, $lname, $email, $uname, $password) {
    8.         $uuid = uniqid('', true);
    9.         $hash = $this->hashSSHA($password);
    10.         $encrypted_password = $hash["encrypted"]; // encrypted password
    11.         $salt = $hash["salt"]; // salt
    12.         $result = mysqli_query($this->db,"INSERT INTO `users`(`unique_id`, `firstname`, `lastname`, `username`, `email`, `encrypted_password`, `salt`, `created_at`) VALUES('$uuid', '$fname', '$lname', '$uname', '$email', '$encrypted_password', '$salt', NOW())") or die(mysqli_error($db));
    13.                                          
    14.   // check for successful store
    15.         if ($result) {
    16.             // get user details
    17.             $uid = mysqli_insert_id($this->db); // last inserted id
    18.             $result = mysqli_query($this->db, "SELECT * FROM users WHERE uid = $uid") or die(mysqli_error($this->db));
    19.             // return user details
    20.             return mysqli_fetch_array($result);
    21.         } else {
    22.             return false;
    23.         }
    24.     }
    25.  
    26.  
     
  17. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    In the code for getJSONFromUrl(), which you have not shown, I presume it's making a HTTP POST request to your server.

    This code will have access to the response message. I can see that your server is putting error messages into the response at several places. You should examine the response to see what error was set. This will tell you why the null value was returned.
    For example, this is one reason for failure

    Code (Text):
    1.  
    2. if ($db->isUserExisted($email))
    3.             {
    4.                 // user is already existed - error response
    5.                 $response["error"] = 2;
    6.                 $response["error_msg"] = "User already existed";
    7.             }
    8.  
    I suspect you have no error checking code at the moment.
     
  18. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    how shall I add error checking code. if user is already registered then it says that user already exists.

    Do you feel its php related issue from the server side instead of Android Studio side.
     
  19. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    Add the error checking code in your getJSONFromUrl() method

    YES!!
     
  20. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    If error checking code shall I add.
     
  21. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    Let's have a look at the getJSONFromUrl() method
     
  22. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
  23. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    Do you have any other advice or solution.
     
  24. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #17
    Points:
    1,488
    Posts:
    6,729
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    6,729
    9,485
    1,488
    Male
    Software developer
    South West of England
    I was asking for you to show your getJSONfromUrl() method. You need to add error checking code to that method.
     
  25. maddie_jones

    maddie_jones Newbie
    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    19
    Joined:
    Mar 17, 2016

    Mar 17, 2016
    19
    1
    16
    I have now added my URL method below.
     

Share This Page

Loading...