title: Am unable to redirect to previous activity in Android Studio
body: <p>I am not able to redirect the current activity to the main activity in Android Studio. I was trying to insert data of sign-up activity to database sqLite but it is not working. </p>
  
  <pre><code>b2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              String s1 = e1.getText().toString();
              String s2 = e2.getText().toString();
              String s3 = e3.getText().toString();
              String s6 = e6.getText().toString();
              if (s1.equals("") || s2.equals("") || s3.equals("") || s6.equals("")) {
                  Toast.makeText(Second.this, "FILL ALL THE FIELDS", Toast.LENGTH_SHORT).show();
              } else {
                  SQLiteDatabase data = openOrCreateDatabase("db1", MODE_PRIVATE, null);
                  data.execSQL("CREATE TABLE IF NOT EXISTS users1(name varchar,email varchar,password varchar,phone varchar)");
                  String s7 = "SELECT * FROM users1 WHERE name='" + s1 + "' and email='" + s2 + "' and password='" + s3 + "'";
                  Cursor cursor = data.rawQuery(s7, null);
                  if (cursor.getCount() &gt; 0) {
                      Toast.makeText(Second.this, "already exists", Toast.LENGTH_SHORT).show();
                  } else {
                      data.execSQL("insert into users1 values('" + s1 + "','" + s2 + "','" + s3 + "','" + s6 + "')");
                      Toast.makeText(Second.this, "all field filled", Toast.LENGTH_SHORT).show();
                      Intent il = new Intent(Second.this, MainActivity.class);
                      startActivity(il);
                      finish();
  
                  }
              }
          }
      });
  </code></pre>
  
  <hr>
  
  <p>Logs as Requested.</p>
  
  <pre><code>    04-28 18:09:44.150 26440-26440/com.example.abhinav.datal E/SQLiteLog: (1) table users1 has 3 columns but 4 values were supplied
  04-28 18:09:44.150 26440-26440/com.example.abhinav.datal D/AndroidRuntime: Shutting down VM
  04-28 18:09:44.151 26440-26440/com.example.abhinav.datal E/AndroidRuntime: FATAL EXCEPTION: main
                                                                             Process: com.example.abhinav.datal, PID: 26440
                                                                             android.database.sqlite.SQLiteException: table users1 has 3 columns but 4 values were supplied (code 1): , while compiling: INSERT INTO users1 VALUES('aa','aa','aa','44')
                                                                                 at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
                                                                                 at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:896)
                                                                                 at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:507)
                                                                                 at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
                                                                                 at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58)
                                                                                 at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:31)
                                                                                 at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1704)
                                                                                 at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1635)
                                                                                 at com.example.abhinav.datal.Second$1.onClick(Second.java:49)
                                                                                 at android.view.View.performClick(View.java:5269)
                                                                                 at android.view.View$PerformClick.run(View.java:21556)
                                                                                 at android.os.Handler.handleCallback(Handler.java:815)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                                 at android.os.Looper.loop(Looper.java:207)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5776)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
  04-28 18:09:49.925 26440-26449/com.example.abhinav.datal I/System: FinalizerDaemon: finalize objects = 126
  </code></pre>