Android WebView propt URL仅一次

Android WebView propt URL仅一次,android,eclipse,android-webview,Android,Eclipse,Android Webview,我有一个使用webview的应用程序。我希望应用程序在首次启动时允许您输入您希望使用的URL并将其绑定到应用程序,除非通过操作系统端的应用程序设置清除默认设置,否则不会再次提示 如何做到这一点? 我在应用程序大楼很新,所以请给我一些说明 package com.namespace; import android.app.Activity; import android.content.res.Configuration; import android.os.Bundle; import and

我有一个使用webview的应用程序。我希望应用程序在首次启动时允许您输入您希望使用的URL并将其绑定到应用程序,除非通过操作系统端的应用程序设置清除默认设置,否则不会再次提示

如何做到这一点? 我在应用程序大楼很新,所以请给我一些说明

package com.namespace;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.Window;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MYAPPNAME extends Activity
{
final Activity activity = this;

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
    setContentView(R.layout.main);
    WebView webView = (WebView) findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    CookieManager.getInstance().setAcceptCookie(true); 
    webView.setWebChromeClient(new WebChromeClient()

    {

        public void onProgressChanged(WebView view, int progress)
        {
            activity.setTitle("Loading...");
            activity.setProgress(progress * 100);

            if(progress == 100)
                activity.setTitle(R.string.app_name);

        }
    });

    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onReceivedError(WebView view, int errorCode, String description,        String failingUrl)
        {
            // Handle the error
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url)
        {
            view.loadUrl(url);
            return true;
        }
    });
    WebSettings settings = webView.getSettings();

    settings.setDomStorageEnabled(true);
    webView.loadUrl("http://my.app.URL");


}
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
}
}

我建议使用SharedReferences。有关示例,请参见