title: How to display my data from my own database in Android
body: <p>I don't know where to insert the select query. I import a external Database(Sqlite browser) in my project and i don't know how to display the data from my database to listview.</p>
  
  <pre><code>public class DatabaseHelper extends SQLiteOpenHelper {
  
      String DB_PATH = null;
      public static String DB_NAME = "extenalDBS";
      private SQLiteDatabase myDataBase;
      private final Context myContext;
  
  
      public DatabaseHelper(Context context) {
          super(context, DB_NAME, null, 1);
          this.myContext = context;
          this.DB_PATH = "/data/data/" + context.getPackageName() + "/" + "databases/";
          Log.e("Path 1", DB_PATH);
      }
  
  
      public void createDataBase() throws IOException {
          boolean dbExist = checkDataBase();
          if (dbExist) {
          } else {
              this.getReadableDatabase();
              try {
                  copyDataBase();
              } catch (IOException e) {
                  throw new Error("Error copying database");
              }
          }
      }
  
      public boolean checkDataBase() {
          SQLiteDatabase checkDB = null;
          try {
              String myPath = DB_PATH + DB_NAME;
              checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
          } catch (SQLiteException e) {
          }
          if (checkDB != null) {
              checkDB.close();
          }
          return checkDB != null ? true : false;
      }
  
      private void copyDataBase() throws IOException {
          InputStream myInput = myContext.getAssets().open(DB_NAME);
          String outFileName = DB_PATH + DB_NAME;
          OutputStream myOutput = new FileOutputStream(outFileName);
          byte[] buffer = new byte[1];
          int length;
          while ((length = myInput.read(buffer)) &gt; 0) {
              myOutput.write(buffer, 0, length);
          }
          myOutput.flush();
          myOutput.close();
          myInput.close();
  
      }
  
      public void openDataBase() throws SQLException {
          String myPath = DB_PATH + DB_NAME;
          myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
  
      }
  
      @Override
      public synchronized void close() {
          if (myDataBase != null)
              myDataBase.close();
          super.close();
      }
  
  
      @Override
      public void onCreate(SQLiteDatabase db) {
      }
  
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
          if (newVersion &gt; oldVersion)
              try {
                  copyDataBase();
              } catch (IOException e) {
                  e.printStackTrace();
  
              }
      }
  
      public Cursor query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) {
          return myDataBase.query("wordbank", null, null, null, null, null, null);
      }
  
  
  
  }
  </code></pre>