Building Database and outputting data in Android
<p>I've built a database class in Android using SQLite, so far it just creates a database and inputs data, however the only <code>log</code> report I see is that the data has been input, but the <code>log</code> never shows for the database creation.</p>

<p>I have also seen people have a <strong>.db</strong> file in their assets folder, mine is not created.</p>

<p>so:
1) How come it's not showing the log error for building the database, and also is there meant to be a .db file created through SQLite? It's my first time using it.</p>

<p>2) If it is creating, how can I call the List from the <code>getData()</code> method and output it in MainActivity? I've tried using intents but once I realised I wasn't getting the <code>log</code> report from the database creation so I need that sorted before anything.</p>

<p><strong>MainActivity.java</strong></p>

<pre><code>public class MainActivity extends Activity {

    Intent appIntent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main); 
        DB db = new DB(this);
        db.insertStudent("T", "T", 5, "T", "T", "T");
        List&lt;tableStudents&gt; outputList = db.getData();  
    }
</code></pre>

<p><strong>DB.java</strong></p>

<pre><code>package com.example.project;    
import java.util.ArrayList;
import java.util.List;    
import com.example.project.tableStudents.tableColumns;    
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import android.view.View;

public class DB extends SQLiteOpenHelper {
    public static final int db_version = 1;  
    public static final String Table = "Students";  
    public static final String Student_ID = "Student_ID";
    public static final String Student_Name = "Student_Name";
    public static final String Student_Password = "Student_Password";
    public static final String Student_Gender = "gender";
    public static final String Student_Age = "age";
    public static final String Student_Course = "course";
    public static final String Modules = "modules";
    public DB(Context context) {
        super(context, tableColumns.Database, null, db_version);                
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //Create Table
        db.execSQL("CREATE TABLE " + Table + "(" + 
                Student_ID + " INTEGER PRIMARY KEY, " +
                Student_Name + " TEXT, " +
                Student_Password + " TEXT, " +
                Student_Gender + " TEXT, " +
                Student_Age + " INTEGER, " +
                Student_Course + " TEXT, " +
                Modules + "TEXT");
        Log.d("DB", "DB Created");


    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + Table);
        onCreate(db);
    }

    public List&lt;tableStudents&gt; getData() {
        List&lt;tableStudents&gt; studentList = new ArrayList&lt;tableStudents&gt;();
        // Select All Query
        String selectQuery = "SELECT  * FROM " + Table;
        SQLiteDatabase db = this.getWritableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);

        // looping through all rows and adding to list
        if (cursor.moveToFirst()) {
            do {
                tableStudents student = new tableStudents();
                student.name = cursor.getString(0);
                student.gender = cursor.getString(1);
                student.age = Integer.parseInt(cursor.getString(2));
                student.password = cursor.getString(3);
                student.course = cursor.getString(4);
                student.modules = cursor.getString(5);
                studentList.add(student);
            } while (cursor.moveToNext());
        }
        // return contact list
        return studentList;
    }


    public boolean insertStudent(String name, String gender, int age, String password, String course, String modules) {
        SQLiteDatabase db = getWritableDatabase();
        ContentValues contentValues = new ContentValues();
        contentValues.put(Student_Name, name);
        contentValues.put(Student_Gender, gender);
        contentValues.put(Student_Age, age);
        contentValues.put(Student_Password, password);
        contentValues.put(Student_Course, course);
        contentValues.put(Modules, modules);

        //Log for admin insert
        Log.d("DB", "Inserted Successfully");
        return true;
    }

}
</code></pre>