save the static pointer to the main Activity in SimpleSSHD because it'll

be used by more than just SimpleSSHDService..
sigsegv_dump
Greg Alexander 10 years ago
parent 1642eec8fd
commit 932bfa3242

@ -16,9 +16,9 @@ import android.net.Uri;
public class SimpleSSHD extends Activity public class SimpleSSHD extends Activity
{ {
private Button startstop_view; private Button startstop_view;
public static SimpleSSHD curr = null;
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState) {
{
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Prefs.init(this); Prefs.init(this);
setContentView(R.layout.main); setContentView(R.layout.main);
@ -28,11 +28,11 @@ public class SimpleSSHD extends Activity
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
update_startstop(); update_startstop();
SimpleSSHDService.activity = this; curr = this;
} }
public void onPause() { public void onPause() {
SimpleSSHDService.activity = null; curr = null;
super.onPause(); super.onPause();
} }

@ -10,7 +10,6 @@ import java.io.FileReader;
public class SimpleSSHDService extends Service { public class SimpleSSHDService extends Service {
public static int sshd_pid = 0; public static int sshd_pid = 0;
public static SimpleSSHD activity = null;
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
@ -84,10 +83,10 @@ public class SimpleSSHDService extends Service {
} }
private static void update_activity() { private static void update_activity() {
if (activity != null) { if (SimpleSSHD.curr != null) {
activity.runOnUiThread(new Runnable() { SimpleSSHD.curr.runOnUiThread(new Runnable() {
public void run() { public void run() {
activity.update_startstop(); SimpleSSHD.curr.update_startstop();
} }
}); });
} }

Loading…
Cancel
Save