Android Open Source - sqlite-analyzer Main Activity






From Project

Back to project page sqlite-analyzer.

License

The source code is released under:

Apache License

If you think the Android project sqlite-analyzer 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 ww. java2s. c o m*/
import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;

import static com.example.sqlite.DB.Columns.Employees;

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_2,
        employees, 
        new String[] {Employees.Firstname, Employees.Lastname},
        new int[] {android.R.id.text1, android.R.id.text2});

    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.MyDatabase.java
com.example.MyDatabase.java
com.novoda.sqlite.Analyzer.java
com.novoda.sqlite.Connector.java
com.novoda.sqlite.FileConnector.java
com.novoda.sqlite.MigrationsConnector.java
com.novoda.sqlite.MigrationsInDir.java
com.novoda.sqlite.Migrations.java
com.novoda.sqlite.NumberedFilesComparator.java
com.novoda.sqlite.StringUtilOld.java
com.novoda.sqlite.StringUtil.java
com.novoda.sqlite.impl.SQLFile.java
com.novoda.sqlite.impl.TableCreateStatementParser.java
com.novoda.sqlite.model.Column.java
com.novoda.sqlite.model.DataAffinity.java
com.novoda.sqlite.model.Database.java
com.novoda.sqlite.model.Table.java
com.novoda.sqliteprovider.demo.simple.provider.FireworkProvider.java
com.novoda.sqliteprovider.demo.simple.ui.MainActivity.java
com.novoda.sqliteprovider.demo.simple.ui.MainFragment.java