开发者

ERROR/LocationManagerService(64): java.lang.IllegalArgumentException: provider=network

I am create a simple web service.

but it generate an error like that shown below

09-25 20:42:56.732: ERROR/LocationManagerService(64): requestUpdates got exception:
09-25 20:42:56.732: ERROR/LocationManagerService(64): java.lang.IllegalArgumentException: provider=network
09-25 20:42:56.732: ERROR/LocationManagerService(64):     at com.android.server.LocationManagerService.requestLocationUpdatesLocked(LocationManagerService.java:861)
09-25 20:42:56.732: ERROR/LocationManagerService(64):     at com.android.server.LocationManagerService.requestLocationUpdates(LocationManagerService.java:831)
09-25 20:42:56.732: ERROR/LocationManagerService(64):     at android.location.ILocationManager$Stub.onTransact(ILocationManager.java:79)
09-25 20:42:56.732: ERROR/LocationManagerService(64):     at android.os.Binder.execTransact(Binder.java:287)
09-25 20:42:56.732: ERROR/LocationManagerService(64):     at dalvik.system.NativeStart.run(Native Method)

java and XML code is shown below

package com.webview;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class WebApplicationActivity extends Activity {
        WebView webView1,webView2;
        @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        webView1 = (WebView) findViewById(R.id.webView1);
        webView1.loadUrl("http://google.com");

//        webView2 = (WebView) findViewById(R.id.webView2);
//        webView2.loadData("<htm开发者_如何学Cl><head></head><body>Hello</body></html>", "text/html", null);

    }
}

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="wrap_content">
    <android.webkit.WebView android:layout_width="fill_parent"
    android:id="@+id/webView1" android:layout_height="300dp"
    android:layout_weight="1"></android.webkit.WebView>
    <!-- <android.webkit.WebView android:id="@+id/webView2"
    android:layout_width="fill_parent" android:layout_height="300dp"
    android:layout_weight="1">
    </android.webkit.WebView> -->
</LinearLayout>


Your error comes from the location manager module trying to get the user current location from the cellular network, not from the code you posted.


check you this code

   WebView  mWebView = (WebView) findViewById(R.id.webview);
   mWebView.setSaveFormData(false);
   mWebView.getSettings().setJavaScriptEnabled(true);
   mWebView.loadUrl("http://www.google.com");

In the xml file. there should be webview id.

  android:id="@+id/webview"

It is also necessary to put this permission on AndroidManifest.xml file.

<uses-permission android:name="android.permission.INTERNET" />

In the HelloAndroid Activity, add this nested class:

private class HelloWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;
}

}

Then towards the end of the onCreate(Bundle) method, set an instance of the HelloWebViewClient as the WebViewClient:

mWebView.setWebViewClient(new HelloWebViewClient());

if you want more about webView click this link1, link2 and link3

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜