小编Sha*_*war的帖子

Android WebView 不加载自动重定向 url

我有一个需要打开特定链接的网络视图。当我点击该链接时,它会将我重定向到另一个链接...我的问题是我能够打开第一个链接但第二个链接没有被调用...请帮助我!

这是我的代码:

public class OnlinePayment extends AppCompatActivity {
    WebView online_payment_activity_web_view;
    String url;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.online_payment_activity);
        Bundle extras = getIntent().getExtras();
        url = extras.getString("redirect_url");
        final ProgressDialog pd = ProgressDialog.show(OnlinePayment.this, "", "Redirecting...", true);
        Log.e("Here redirect first", url);
        online_payment_activity_web_view=(WebView) findViewById(R.id.online_payment_web_view);
        online_payment_activity_web_view.getSettings().setJavaScriptEnabled(true);
        online_payment_activity_web_view.getSettings().setSupportZoom(true);
        online_payment_activity_web_view.getSettings().setBuiltInZoomControls(true);
        online_payment_activity_web_view.getSettings().setDisplayZoomControls(false);
        online_payment_activity_web_view.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        online_payment_activity_web_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        online_payment_activity_web_view.setWebChromeClient(new WebChromeClient());
        online_payment_activity_web_view.getSettings().setLoadWithOverviewMode(true);
        online_payment_activity_web_view.getSettings().setUseWideViewPort(true);
        online_payment_activity_web_view.setWebViewClient(new WebViewClient() {

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                return false;
            }
            /**
             * Notify the host application that an SSL error occurred while loading a
             * resource. …
Run Code Online (Sandbox Code Playgroud)

java android android-webview android-fragments android-studio

2
推荐指数
1
解决办法
6271
查看次数

为什么在 Java 的 2D / 3D 数组中需要行大小和列大小可选?

我总是很困惑,为什么 Java 中的 2D 数组对声明行的大小而不是列的大小有严格的要求,这进一步混淆了 3D 和 4D 数组。

// Invalid, 2D array with no row and no column?
int[][] arr = new int[][];
// Valid, 2D array of size 2X3
int[][] arr = new int[2][3];
// Valid, column size is not specified, size of 2D array?
int[][] arr = new int[2][];
// Valid, column size is not specified, size of 3D array?
int[][][] arr = new int[2][][];
Run Code Online (Sandbox Code Playgroud)

java arrays multidimensional-array

2
推荐指数
1
解决办法
105
查看次数