package com.google.zxing.client.android.share; import android.app.ListActivity; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.util.Log; import android.view.View; import android.widget.ListView; import java.util.ArrayList; import java.util.List; /* loaded from: classes.dex */ public final class BookmarkPickerActivity extends ListActivity { private static final String b = BookmarkPickerActivity.class.getSimpleName(); private static final String[] c = {"title", "url"}; private static final Uri d = Uri.parse("content://browser/bookmarks"); private final List a = new ArrayList(); @Override // android.app.ListActivity protected void onListItemClick(ListView listView, View view, int i, long j) { String[] strArr = this.a.get(i); Intent intent = new Intent(); intent.addFlags(524288); intent.putExtra("title", strArr[0]); intent.putExtra("url", strArr[1]); setResult(-1, intent); finish(); } @Override // android.app.Activity protected void onResume() { super.onResume(); this.a.clear(); Cursor query = getContentResolver().query(d, c, "bookmark = 1 AND url IS NOT NULL", null, null); try { if (query == null) { Log.w(b, "No cursor returned for bookmark query"); finish(); if (query != null) { query.close(); return; } return; } while (query.moveToNext()) { this.a.add(new String[]{query.getString(0), query.getString(1)}); } if (query != null) { query.close(); } setListAdapter(new BookmarkAdapter(this, this.a)); } catch (Throwable th) { try { throw th; } catch (Throwable th2) { if (query != null) { try { query.close(); } catch (Throwable th3) { th.addSuppressed(th3); } } throw th2; } } } }