Android Open Source - android-sqlite-asset-helper Main Activity






From Project

Back to project page android-sqlite-asset-helper.

License

The source code is released under:

Apache License

If you think the Android project android-sqlite-asset-helper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example;
//  w  w  w  . j av a 2s  .  c o m
import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;

public class MainActivity extends ListActivity {

  private Cursor employees;
  private MyDatabase db;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    db = new MyDatabase(this);
    employees = db.getEmployees(); // you would not typically call this on the main thread

    ListAdapter adapter = new SimpleCursorAdapter(this, 
        android.R.layout.simple_list_item_1, 
        employees, 
        new String[] {"FirstName"}, 
        new int[] {android.R.id.text1});

    getListView().setAdapter(adapter);
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
    employees.close();
    db.close();
  }

}




Java Source Code List

com.example.MainActivity.java
com.example.MainActivity.java
com.example.MainActivity.java
com.example.MyDatabase.java
com.example.MyDatabase.java
com.example.MyDatabase.java
com.readystatesoftware.sqliteasset.SQLiteAssetHelper.java
com.readystatesoftware.sqliteasset.Utils.java
com.readystatesoftware.sqliteasset.VersionComparator.java