SQLite
 sql >> Teknologi Basis Data >  >> RDS >> SQLite

Android - Kursor diMapReady (Penanda)

Akhirnya saya berhasil memperbaikinya, semoga ini bisa membantu seseorang.

Sumber ParkData Saya:

public Cursor getAll() {
        return db.rawQuery("SELECT * FROM " + SQLiteHelper.TABLE_PARKS,
                null);
    }

Fragmen Saya:

SQLiteHelper dbHelper = new SQLiteHelper(getActivity());
        pds = new ParksDataSource(dbHelper.db);
        cursor = pds.getAll();

        List<Marker> markersList = new ArrayList<Marker>();
        int i = 0;
        try {
            while (cursor.moveToNext()) {
                String[] latlong = cursor.getString(cursor.getColumnIndex(SQLiteHelper.COL_PARKS_COORDINATES)).split(",");
                double latitude = Double.parseDouble(latlong[0]);
                double longitude = Double.parseDouble(latlong[1]);
                mark = new LatLng(latitude, longitude);

                if (cursor.getString(cursor.getColumnIndex(SQLiteHelper.COL_PARKS_SLOTS)) == null){

                    Marker mPark = map.addMarker(new MarkerOptions().position(mark)
                            .title(cursor.getString(cursor.getColumnIndex(SQLiteHelper.COL_PARKS_TITLE)))
                            .icon(BitmapDescriptorFactory.fromBitmap(writeTextOnDrawable(R.mipmap.ic_pin, cursor.getString(cursor.getColumnIndex(SQLiteHelper.COL_PARKS_FREE))))));
                    mPark.setTag(0);
                    markersList.add(mPark);
                }
                i++;
            }
        } finally {
            cursor.close();
        }

        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Marker m : markersList) {
            builder.include(m.getPosition());
        }



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Operator INTERSECT SQLite

  2. Tabel isi sebelumnya ActiveAndroid menggunakan migrasi skema

  3. Bisakah entri basis data yang ditambahkan dari item dihapus dengan tombol?

  4. Android:SQLite menyimpan larik string?

  5. (Android) Temukan jalur /Android di penyimpanan internal