- @TargetApi(Build.VERSION_CODES.N)
- public static void hookAutocompletionAdapter(final Context context,
- final AutoCompleteTextView view,
- final String table, final String field) {
- hookAutocompletionAdapter(context, view, table, field, true, null, null);
- }
- @TargetApi(Build.VERSION_CODES.N)
- public static void hookAutocompletionAdapter(final Context context,
- final AutoCompleteTextView view,
- final String table, final String field,
- final boolean profileSpecific,
- final DescriptionSelectedCallback callback,
- final MobileLedgerProfile profile) {
- String[] from = {field};
- int[] to = {android.R.id.text1};
- SimpleCursorAdapter adapter =
- new SimpleCursorAdapter(context, android.R.layout.simple_dropdown_item_1line, null,
- from, to, 0);
- adapter.setStringConversionColumn(1);
-
- FilterQueryProvider provider = constraint -> {
- if (constraint == null) return null;
-
- String str = constraint.toString().toUpperCase();
- debug("autocompletion", "Looking for " + str);
+ public static void queryInBackground(@NonNull String statement, String[] params,
+ @NonNull final CallbackHelper callbackHelper) {
+ /* All callbacks are called in the new (asynchronous) thread! */
+ Thread t = new Thread(() -> {
+ callbackHelper.onStart();
+ try {
+ SQLiteDatabase db = App.getDatabase();