Thursday, January 23, 2014

android WebView load Baidu map is blank


            
I used webview to load another address can not do is load Baidu, Daniel door to look
url is: http://211.138.195.130:8803/client/bmap.jsp?shop_id=218193


My program is:
 

package cn.anycall.shop;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

public class MerchantActivity extends Activity {
private WebView shopmap;
private TextView titlebar;
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.merchant);

shopmap = (WebView) findViewById (R.id.shopmap);
titlebar = (TextView) findViewById (R.id.titlebar);


shopmap.getSettings () setJavaScriptEnabled (true);.

WebSettings webSettings = shopmap.getSettings ();
/ / This method can handle when webview while loading and loading is complete some operations
shopmap.setWebChromeClient (new WebChromeClient () {
public void onProgressChanged (WebView view, int newProgress) {
if (newProgress == 100) {/ / set the activity here is the title, you can also do some other operations
according to their needstitlebar.setText ("finished loading");
} Else {
titlebar.setText ("Loading .......");

}
}
});





webSettings.setAllowFileAccess (true);
webSettings.setJavaScriptEnabled (true);
webSettings.setBlockNetworkImage (true);
webSettings.setBuiltInZoomControls (true);
webSettings.setJavaScriptCanOpenWindowsAutomatically (true);
webSettings.setLoadsImagesAutomatically (true);
webSettings.setPluginsEnabled (true);

shopmap.loadUrl ("http://211.138.195.130:8803/client/bmap.jsp?shop_id=218193");
}

}




Profiles:

 

android: layout_width = "fill_parent" android: layout_height = "fill_parent"
android: background = "# FFFFFF">
android: layout_height = "40dp" android: background = "@ drawable / tou"
android: text = "Merchant Map" android: gravity = "center" android: textColor = "# FFFFFF"
android: textSize = "20dp" />

android: layout_height = "wrap_content" />



Network access have been added to the:


Large cattle were loaded to see why a blank!


Reply:
The post top!
Reply:
Code looks right! Is not networked machines? LOAD other URL you try, what are into google hao123
Reply:
There are two callback should not achieve
shopmap.setWebChromeClient (webChromeClient);
webChromeClient callback onExceededDatabaseQuota, onReachedMaxAppCacheSize need to achieve
Specific reference to the source
own browser

Reply:
I also began to think this problem is very curious, then thought better of it, can not be directly used WebView to specify. The map is not a web so big, so fixed, even to directly specify, but also specify the latitude and longitude and the like to determine the location.
Specific steps can be found in:
http://code.google.com/intl/zh-CN/apis/maps/articles/android_v3.html
Reply:
Did not seem to add a blank key, oh. .
Reply:
references, 5th Floor maoning20080808 reply:
did not seem to add a blank key, oh. .


I do not remember the key will own trance error of
Reply:
I looked for a long time did not feel defeated where there are problems ......
Mark what ......
Reply:
Will the landlord problem solved? ? ?
Reply:
Landlord solve it
Reply:
/ / Set webview can load Web Images
webSettings.setBlockNetworkImage (false);
webSettings.setBlockNetworkLoads (false);
This set look like a
Lz may not see, but for the convenience of other passers-by, or my solution posted about it
Reply:
I also encountered. Landlord solved yet
Reply:
webSettings.setDomStorageEnabled (true);
Plus on it

No comments:

Post a Comment