how can I display a interactive map in webview?

2019-09-19 03:36发布

I am trying to display a interactive map that I have created with imapbuilder. The problem is when i load it in my webview I just get a blank screen. I have tried everything (am just wondering if my device can't handle flash have got sgs2 and Motorola xoom2 10.1in tablet with ICS on both). Here is my code for XML.

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >



<WebView android:id="@+id/webview"

    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>



</LinearLayout> 

For my .java;

import android.os.Bundle;
import android.app.Activity;
import android.os.Handler; 
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView; 

public class MainActivity extends Activity { 

  private Handler mHandler = new Handler(); 

  @Override 
  public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    this.getWindow().setFlags   
    (WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    setContentView(R.layout.activity_main); 
    WebView view=(WebView)findViewById(R.id.webview);
    view.getSettings().setPluginsEnabled(true);
    view.loadUrl("file:///android_asset/Interactive.htm"); 
    view.addJavascriptInterface(new MyJavaScriptInterface(), "Android"); 
} 

final class MyJavaScriptInterface 
{ 
    public void ProcessJavaScript(final String scriptname, final String args) 
        {              
            mHandler.post(new Runnable() 
                { 
                    public void run() 
                        { 
                            //Do your activities 
                        } 
                });
        }
}
}

In my assets folder is the Interactive.htm and sub folder with the flash files and stuff exported from the software I used. So where am I going wrong?

1条回答
别忘想泡老子
2楼-- · 2019-09-19 04:12

Did you add this permission to your manifest file?

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

查看更多
登录 后发表回答