Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
716 views
in Technique[技术] by (71.8m points)

flash - Problem loading swf file in android

I have a problem when I load interactive SWF file in android emulator. I use 2.3.1 AVD.

This is the code:

package com.androidpeople.view;

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

    public class WebViewExample extends Activity {

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            /*WebView webView = (WebView) findViewById(R.id.webview);
            webView.getSettings().setJavaScriptEnabled(true);
            webView.loadUrl("http://www.androidpeople.com");

            webView.setWebViewClient(new HelloWebViewClient());*/

            String html =
                "<object width="550" height="400"> <param name="movie" value="file:///android_asset/FL.swf"> <embed src="file:///android_asset/FL.swf" width="550" height="400"> </embed> </object>";
                String mimeType = "text/html";
                String encoding = "utf-8";

            WebView wv=(WebView) findViewById(R.id.webview);
            wv.getSettings().setJavaScriptEnabled(true);
            wv.getSettings().setPluginsEnabled(true);
            wv.loadDataWithBaseURL("null", html, mimeType, encoding,  "");
            wv.setWebViewClient(new HelloWebViewClient());



        }
    }


package com.androidpeople.view;

import android.webkit.WebView;
import android.webkit.WebViewClient;

public class HelloWebViewClient extends WebViewClient {

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;
}

} 

Manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.androidpeople.view"
  android:versionCode="1"
  android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".WebViewExample"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>
<uses-sdk android:minSdkVersion="5" />

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

</manifest> 

Now the problem is that when I run the project, it will give one box at center right side 3D dimension like:

this is the image

I have also tried to change different-different SWF file but can't get proper solution.

Can anyone help me? Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

That's just because you need to install flash Player. Download the apk from adobe website and install it on the emulator.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...