0
我創建了一個android webview應用程序,並添加了一個類來在應用程序中打開內部URL,但允許外部URL使用瀏覽器。我不斷收到錯誤:android error:沒有找到合適的方法 - 編譯失敗
"Error:(21, 26) error: no suitable method found for startActivities(Intent) method Context.startActivities(Intent[],Bundle) is not applicable (actual and formal argument lists differ in length) method Context.startActivities(Intent[]) is not applicable (actual argument Intent cannot be converted to Intent[] by method invocation conversion)"
package edu.httpsocc.mylakerlinkgo;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
/**
* Created by 130308 on 11/25/2015.
*/
public class MyAppWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if(Uri.parse(url).getHost().endsWith("mylakerlink.socc.edu/go")) {
return false;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
view.getContext().startActivities(intent);
return true;
}
}