From 0bdcab134c7091a1a5c2440f78cc2b4beb9f745f Mon Sep 17 00:00:00 2001 From: arrase Date: Mon, 28 Nov 2016 22:25:59 +0100 Subject: [PATCH] get data from cursor --- .../org/torproject/android/OrbotMainActivity.java | 1 - .../ui/hiddenservices/HiddenServicesActivity.java | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java index aeb4a18a..a4bb32e9 100644 --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java @@ -618,7 +618,6 @@ public class OrbotMainActivity extends AppCompatActivity Intent nResult = new Intent(); while (hostname == null) { - //we need to stop and start Tor try { Thread.sleep(3000); //wait three seconds } catch (Exception e) { diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java index 9de02966..d7526324 100644 --- a/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java +++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java @@ -4,6 +4,7 @@ package org.torproject.android.ui.hiddenservices; import android.content.ContentResolver; import android.content.pm.PackageManager; import android.database.ContentObserver; +import android.database.Cursor; import android.os.Bundle; import android.os.Handler; import android.support.design.widget.FloatingActionButton; @@ -70,12 +71,16 @@ public class HiddenServicesActivity extends AppCompatActivity { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { - TextView port = (TextView) view.findViewById(R.id.hs_port); - TextView onion = (TextView) view.findViewById(R.id.hs_onion); + Cursor item = (Cursor) parent.getItemAtPosition(position); Bundle arguments = new Bundle(); - arguments.putString("port", port.getText().toString()); - arguments.putString("onion", onion.getText().toString()); + arguments.putString( + "port", item.getString(item.getColumnIndex(HSContentProvider.HiddenService.PORT)) + ); + + arguments.putString( + "onion",item.getString(item.getColumnIndex(HSContentProvider.HiddenService.DOMAIN)) + ); HSActionsDialog dialog = new HSActionsDialog(); dialog.setArguments(arguments);