diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/org/traccar/manager/MainActivity.java | 3 | ||||
-rw-r--r-- | app/src/main/java/org/traccar/manager/MainFragment.java | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/app/src/main/java/org/traccar/manager/MainActivity.java b/app/src/main/java/org/traccar/manager/MainActivity.java index 39d04ec..fd4c23b 100644 --- a/app/src/main/java/org/traccar/manager/MainActivity.java +++ b/app/src/main/java/org/traccar/manager/MainActivity.java @@ -33,8 +33,7 @@ public class MainActivity extends Activity { } private void initContent() { - String url = PreferenceManager.getDefaultSharedPreferences(this).getString(PREFERENCE_URL, null); - if (url != null) { + if (PreferenceManager.getDefaultSharedPreferences(this).contains(PREFERENCE_URL)) { getFragmentManager().beginTransaction().add(android.R.id.content, new MainFragment()).commit(); } else { getFragmentManager().beginTransaction().add(android.R.id.content, new StartFragment()).commit(); diff --git a/app/src/main/java/org/traccar/manager/MainFragment.java b/app/src/main/java/org/traccar/manager/MainFragment.java index cfa4827..5b2c5c5 100644 --- a/app/src/main/java/org/traccar/manager/MainFragment.java +++ b/app/src/main/java/org/traccar/manager/MainFragment.java @@ -18,6 +18,7 @@ package org.traccar.manager; import android.content.pm.ApplicationInfo; import android.os.Build; import android.os.Bundle; +import android.preference.PreferenceManager; import android.view.View; import android.webkit.WebSettings; import android.webkit.WebView; @@ -40,7 +41,10 @@ public class MainFragment extends WebViewFragment { webSettings.setDomStorageEnabled(true); webSettings.setDatabaseEnabled(true); - getWebView().loadUrl("http://10.0.2.2:8082"); + String url = PreferenceManager.getDefaultSharedPreferences( + getActivity()).getString(MainActivity.PREFERENCE_URL, null); + + getWebView().loadUrl(url); } } |