Go back to previous activity manually
<p>Here's my code:
Activity1 (main): Checks if the db has any rows. If not, load the main view. If it has at least 1 start Activity2</p>

<pre><code>    int num = db.numOfRows();
    if(num==0){
        setContentView(R.layout.main);
    } else {
        startActivity(new Intent(this, Activity2.class));
    }
</code></pre>

<p>Activity 2: Loads the moreprojects view which populates table rows with db information.</p>

<pre><code>        super.onCreate(savedInstanceState);
        setContentView(R.layout.moreprojects);
        populateRows();
</code></pre>

<p>non-activity dbhandler: contains all the database stuff (db mentioned in Activity1). Now, on Activity2 you can delete the rows which calls the method below. Within that if(num==0) I would like to have Activity2 call Activity1. Activity1 is the screen which allows for creating of projects.</p>

<pre><code>public void deleteContact(int id) {
    SQLiteDatabase db = this.getWritableDatabase();
    db.delete(TABLE_blah, KEY_ID + " = ?",
            new String[] { String.valueOf(id) });
    int num = numOfRows();
    Log.d("Testing","Number of rows: "+num);

    if(num ==0){
        //go back to Activity1
    }
    db.close();
}
</code></pre>

<p>I hope this makes sense. </p>

<p>I've been trying multiple different things such as:
creating a method in activity2 which does finish();... but that doesn't do anything. It just seems to reload Activity2. </p>

<p>Please help!</p>
