#AskAndroid - Android Dev Summit Livestream

Published 2019-10-10
Have any burning questions about Android that you always wanted answers to? Well now you can with our first ever #AskAndroid livestream segment at Android Dev Summit 2019! Remember to tweet your questions using #AskAndroid for the chance to get your questions answered live during the Android Dev Summit Livestream.


Tune in during Android Dev Summit → goo.gle/ads19-livestream


Get excited for Android Dev Summit playlist → goo.gle/2mkDnep
Subscribe to the Android Developers channel → goo.gle/AndroidDevs




#Android #Featured #Develop

All Comments (14)
  • @alxizr
    What is the "The Way" to handle background threads in android with Java? I'm asking this question as the docs are referring Asynctask ( 🤢🤮 ) looper/handler, work manager, threads/runnables, executors or maybe services ?? Thanks
  • @quilayo9331
    #AskAndroid hello I made some (different) tones for a phone, how and where can I show them? Thank you!
  • @devonchase6631
    I was wondering if you could send me some information on how to check if my phone has a bug it's the Galaxy 10 s e my grandson downloaded a few games and I have a feeling They had a virus
  • #AskAndroid how we can create android app using python and other language expect java and kotlin can we also create ios app using android studio if is how How can we implement Machine learning in android application
  • #askAndroid how we can create android app using python and other language expect java and kotlin can we also create ios app using android studio
  • Db2 String sortOrder = ArtistMaster.Artists.COLUMN_1 + " ASC"; Cursor cursor = db.query( ArtistMaster.Artists.TABLE_NAME, // The table to query projection, // The array of columns to return (pass null to get all) null, // The columns for the WHERE clause null, // The values for the WHERE clause null, // don't group the rows null, // don't filter by row groups sortOrder // The sort order ); List artistIds = new ArrayList<>(); List artistNames = new ArrayList<>(); while(cursor.moveToNext()) { long artistId = cursor.getLong(cursor.getColumnIndexOrThrow(ArtistMaster.Artists._ID)); String artistName = cursor.getString(cursor.getColumnIndexOrThrow(ArtistMaster.Artists.COLUMN_1)); artistIds.add(artistId); artistNames.add(artistName); } cursor.close(); return artistNames; } public List searchPhotograph (String artistName){ SQLiteDatabase db = getReadableDatabase(); // Define a projection that specifies which columns from the database // you will actually use after this query. String[] projection = { BaseColumns._ID, ArtistMaster.Photographs.COLUMN_1, ArtistMaster.Photographs.COLUMN_2, ArtistMaster.Photographs.COLUMN_3, ArtistMaster.Photographs.COLUMN_4 }; // // Filter results WHERE "title" = 'My Title' // String selection = ArtistMaster.Artists.COLUMN_1 + " = ?"; // String[] selectionArgs = { artistName }; // // // How you want the results sorted in the resulting Cursor // String sortOrder = // ArtistMaster.Photographs.COLUMN_1 + " ASC"; // // Cursor cursor = db.query( // FeedEntry.TABLE_NAME, // The table to query // projection, // The array of columns to return (pass null to get all) // selection, // The columns for the WHERE clause // selectionArgs, // The values for the WHERE clause // null, // don't group the rows // null, // don't filter by row groups // sortOrder // The sort order // ); String query = "SELECT * FROM "+ ArtistMaster.Photographs.TABLE_NAME+" , "+ ArtistMaster.Artists.TABLE_NAME + " WHERE "+ ArtistMaster.Artists._ID +"="+ ArtistMaster.Photographs.COLUMN_2; Cursor cursor = db.rawQuery(query,null); List photographs = new ArrayList<>(); while(cursor.moveToNext()) { byte[] photograph = cursor.getBlob(cursor.getColumnIndexOrThrow(ArtistMaster.Photographs.COLUMN_4)); photographs.add(photograph); } cursor.close(); return photographs; } public int getArtistID (String artistName){ SQLiteDatabase db = getReadableDatabase(); // Define a projection that specifies which columns from the database // you will actually use after this query. String[] projection = { BaseColumns._ID, ArtistMaster.Artists.COLUMN_1, }; // Filter results WHERE "title" = 'My Title' String selection = ArtistMaster.Artists.COLUMN_1 + " = ?"; String[] selectionArgs = { artistName }; // How you want the results sorted in the resulting Cursor String sortOrder = ArtistMaster.Artists._ID + " ASC"; Cursor cursor = db.query( ArtistMaster.Artists.TABLE_NAME, // The table to query projection, // The array of columns to return (pass null to get all) selection, // The columns for the WHERE clause selectionArgs, // The values for the WHERE clause null, // don't group the rows null, // don't filter by row groups sortOrder // The sort order ); int artistID = 0; while(cursor.moveToNext()) { artistID = cursor.getInt(cursor.getColumnIndexOrThrow(ArtistMaster.Artists._ID)); } cursor.close(); return artistID; } public List loadPhotoNames (){ SQLiteDatabase db = getReadableDatabase(); // Define a projection that specifies which columns from the database // you will actually use after this query. String[] projection = { BaseColumns._ID, ArtistMaster.Photographs.COLUMN_1, }; // Filter results WHERE "title" = 'My Title' String selection = ArtistMaster.Photographs.COLUMN_1 + " = ?"; String[] selectionArgs = { "My Title" }; // How you want the results sorted in the resulting Cursor String sortOrder = ArtistMaster.Photographs.COLUMN_1 + " ASC"; Cursor cursor = db.query( ArtistMaster.Photographs.TABLE_NAME, // The table to query projection, // The array of columns to return (pass null to get all) null, // The columns for the WHERE clause null, // The values for the WHERE clause null, // don't group the rows null, // don't filter by row groups sortOrder // The sort order ); List photoIds = new ArrayList<>(); List photoNames = new ArrayList<>(); while(cursor.moveToNext()) { long photoId = cursor.getLong(cursor.getColumnIndexOrThrow(ArtistMaster.Photographs._ID)); String photoName = cursor.getString(cursor.getColumnIndexOrThrow(ArtistMaster.Photographs.COLUMN_1)); photoIds.add(photoId); photoNames.add(photoName); } cursor.close(); return photoNames; } public ArrayList loadArtistsTest(){ SQLiteDatabase db = getReadableDatabase(); String projection[] = { ArtistMaster.Artists._ID, ArtistMaster.Artists.COLUMN_1 }; Cursor rows = db.query( ArtistMaster.Artists.TABLE_NAME, projection, null, null, null, null, null ); ArrayList artistsList = new ArrayList<>(); while(rows.moveToNext()){ int artistId = rows.getInt(rows.getColumnIndexOrThrow(ArtistMaster.Artists._ID)); String artistName = rows.getString(rows.getColumnIndexOrThrow(ArtistMaster.Artists.COLUMN_1)); Artist artist = new Artist(artistId, artistName); artistsList.add(artist); } return artistsList; }
  • Artist package com.scorpion.pastpaperjune.Models; public class Artist { private int id; private String name; public Artist() { } public Artist(int id, String name) { this.id = id; this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
  • Db 3 public ArrayList searchPhotographTest(String artistName){ SQLiteDatabase db = getReadableDatabase(); Cursor rows = db.rawQuery( "SELECT PhotographDetails._ID, photographName, artistId, photoCategory, image FROM PhotographDetails JOIN ArtistDetails ON PhotographDetails.artistId = ArtistDetails._ID WHERE ArtistDetails.artistName = ?", new String[]{artistName} ); ArrayList photoList = new ArrayList<>(); while(rows.moveToNext()){ int id = rows.getInt(rows.getColumnIndexOrThrow(ArtistMaster.Photographs._ID)); String name = rows.getString(rows.getColumnIndexOrThrow(ArtistMaster.Photographs.COLUMN_1)); int artistId = rows.getInt(rows.getColumnIndexOrThrow(ArtistMaster.Photographs.COLUMN_2)); String category = rows.getString(rows.getColumnIndexOrThrow(ArtistMaster.Photographs.COLUMN_3)); byte[] image = rows.getBlob(rows.getColumnIndexOrThrow(ArtistMaster.Photographs.COLUMN_4)); Photograph photo = new Photograph(id, name, artistId, category, image); photoList.add(photo); } return photoList; } }