When testing the app
After entering the username, email and password then clicking Sign Up Button the program crash and stop working
package com.example.ashraf.gocenetr;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.backendless.Backendless;
import com.backendless.BackendlessUser;
import com.backendless.exceptions.BackendlessFault;
import com.backendless.async.callback.AsyncCallback;
public class RegisterActivity extends AppCompatActivity {
private static final String APP_ID = "D8D37700-A4B8-782A-FFEC-99244E147500";
private static final String SECRET_KEY = "6CD85EE3-669F-CDE8-FF38-F821A763BF00";
private static final String VERSION = "v1";
private TextView mUserNameRegister;
private TextView mEmailRegister;
private TextView mPasswordRegister;
private Button mUserNameSignUpButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
Backendless.initApp(RegisterActivity.this, APP_ID, SECRET_KEY, VERSION);
mUserNameRegister = (TextView) findViewById(R.id.userNameRegister);
mEmailRegister = (TextView) findViewById(R.id.eMailRegister);
mPasswordRegister = (TextView) findViewById(R.id.passwordRegister);
mUserNameSignUpButton = (Button) findViewById(R.id.SignUp);
mUserNameSignUpButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
String username = mUserNameRegister.getText().toString();
String email = mEmailRegister.getText().toString();
String password = mPasswordRegister.getText().toString();
BackendlessUser user = new BackendlessUser();
user.setProperty( "name", username );
user.setProperty( "email", email );
user.setPassword(password);
Backendless.UserService.register( user, new AsyncCallback<BackendlessUser>()
{
public void handleResponse( BackendlessUser registeredUser )
{
Toast.makeText(RegisterActivity.this, "You registered successfully.", Toast.LENGTH_SHORT).show();
}
public void handleFault( BackendlessFault fault )
{
Toast.makeText(RegisterActivity.this, "You registered unsuccessfully.", Toast.LENGTH_SHORT).show();
}
} );
}
});
}
}
And this is the xml file too
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.ashraf.gocenetr.RegisterActivity">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/userNameRegister"
android:hint="User Name"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/eMailRegister"
android:hint="E-Mail"
android:layout_below="@+id/userNameRegister"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/passwordRegister"
android:hint="Password"
android:layout_below="@+id/eMailRegister"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign Up"
android:id="@+id/SignUp"
android:layout_below="@+id/passwordRegister"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
And here is the manifest file too
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ashraf.gocenetr">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".RegisterActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>