16 thoughts on “Building a Single Integrated Registration and Login System on Android with Parse.com”

  1. Great tutorial

    What happens if the user deletes and reinstalls the app to the same device without SMS verification.

    1. I haven’t written about SMS verification yet (second part of this tutorial) but if you delete and re-install that won’t change the backend data. So you’ll still get automatically logged in if you’d registered earlier. Btw, till I write the second part, this article might be helpful in implementing SMS verification for you guys – http://codetheory.in/android-sms/

  2. Hi,
    Plz send me the complete code with sms verification process part also.
    thanks in advance for your help…………….. plz i waiting for your response…

  3. App is getting crashed on its launch.
    And also, when there is no activity_main.xml, how can a MainActivity be opened up when its launched?!

  4. Hi Rishabh

    I have a one problem regarding to the Parse, when i change the password of Parse user it will successfully change and second time try to change the password it will not change. is that compulsory to logout from parse after changing password, help me…

    Thanks.

  5. package com.login;

    import java.io.Serializable;

    /**
    * Created by Jai on 6/10/2017.
    */

    public class Pojo implements Serializable {
    String name;
    String loc;
    String usernam;
    String pass;

    public String getName() {
    return name;
    }

    public void setName(String name) {
    this.name = name;
    }

    public String getLoc() {
    return loc;
    }

    public void setLoc(String loc) {
    this.loc = loc;
    }

    public String getUsernam() {
    return usernam;
    }

    public void setUsernam(String usernam) {
    this.usernam = usernam;
    }

    public String getPass() {
    return pass;
    }

    public void setPass(String pass) {
    this.pass = pass;
    }
    }

  6. package com.login;

    import android.app.Activity;
    import android.app.AlertDialog;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;
    import android.widget.Toast;

    public class MainActivity extends Activity {
    String username,password;
    EditText user,pas;
    TextView unam,pass;
    Button lbt,sbt,fpas;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    user = (EditText)findViewById(R.id.urn);
    pas=(EditText)findViewById(R.id.pass);
    unam = (TextView)findViewById(R.id.ur);
    pass = (TextView)findViewById(R.id.pa);
    lbt = (Button)findViewById(R.id.lbt);
    sbt =(Button)findViewById(R.id.sbtn);
    fpas=(Button)findViewById(R.id.fpas);

    sbt.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    Intent si = new Intent(MainActivity.this,SignActivity.class);
    startActivity(si);
    }
    });

    lbt.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    username = user.getText().toString();
    password = pas.getText().toString();

    sqlite sq = new sqlite(MainActivity.this);
    boolean b = sq.login(username,password);

    if (b==true) {
    Intent it = new Intent(MainActivity.this,list .class);
    Toast.makeText(MainActivity.this,”welcome ” +username,Toast.LENGTH_LONG).show();

    startActivity(it);

    }
    else {
    Toast.makeText(MainActivity.this,”wrong username/password”,Toast.LENGTH_LONG).show();
    }
    }
    });

    fpas.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    Intent fp = new Intent(MainActivity.this,Forgot.class);
    startActivity(fp);
    }
    });

    }
    }

  7. package com.login;

    import android.app.Activity;
    import android.content.ContentValues;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;
    import android.widget.Toast;

    import static android.R.attr.name;

    public class SignActivity extends Activity {

    TextView snam,pass,loc,con,uname;
    EditText enam,epass,email,econ,eunam;
    Button subtn;
    sqlite sq;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign);

    enam = (EditText) findViewById(R.id.sena);
    epass = (EditText) findViewById(R.id.sepas);
    email = (EditText) findViewById(R.id.semail);
    econ = (EditText) findViewById(R.id.secpas);
    eunam = (EditText) findViewById(R.id.seuna);
    subtn = (Button) findViewById(R.id.subtn);

    subtn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {

    if (enam.getText().toString().equals(“”)|| email.getText().toString().equals(“”)) {

    enam.setError(“field is empty”);
    }
    else {

    ContentValues conValue = new ContentValues();
    conValue.put(“name”, enam.getText().toString());
    conValue.put(“loc”, email.getText().toString());
    conValue.put(“unam”, eunam.getText().toString());
    conValue.put(“pass”, epass.getText().toString());
    sqlite sqli = new sqlite(SignActivity.this);
    long i = sqli.insertAction(conValue, “login”);
    Toast.makeText(SignActivity.this, “successfully entered”+i, Toast.LENGTH_LONG).show();

    enam.setText(“”);
    email.setText(“”);
    epass.setText(“”);
    econ.setText(“”);
    eunam.setText(“”);
    }
    }
    });
    }
    }

  8. package com.login;

    import android.content.ContentValues;
    import android.content.Context;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteOpenHelper;
    import android.widget.Toast;

    import java.util.ArrayList;

    /**
    * Created by Jai on 6/10/2017.
    */

    public class sqlite extends SQLiteOpenHelper {
    private static final int Database_version = 1;
    private static final String Dbname = “log.db”;
    SQLiteDatabase db;

    Context con;
    public sqlite(Context context) {
    super(context, Dbname, null, 1);
    con = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
    db.execSQL(“create table login (id integer primary key autoincrement,name varchar, unam varchar,loc varchar, pass varchar)”);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL(“drop table if exists” + db);

    }

    public long insertAction(ContentValues cValuea, String tablename) {
    SQLiteDatabase db = this.getWritableDatabase();
    long i = db.insert(tablename, null, cValuea);
    db.close();
    return i;
    }

    public boolean login(String usr, String pass) {

    SQLiteDatabase dblogin = this.getReadableDatabase();
    Cursor cursor = dblogin.rawQuery(“select * from login where unam=? and pass=?”, new String[]{usr, pass});
    if (cursor.getCount() > 0) {
    return true;
    }
    return false;
    }

    public ArrayList getall() {
    SQLiteDatabase dball = this.getWritableDatabase();
    Cursor all = dball.rawQuery(“select * from login”,null);
    ArrayList li = new ArrayList();
    while(all.moveToNext())
    {
    Pojo p =new Pojo();
    p.setUsernam(all.getString(2));
    p.setPass(all.getString(4));
    li.add(p);
    }

    return li;

    }

    }

Leave a Reply

Your email address will not be published. Required fields are marked *