播放.swf声音文件?

时间:2011-07-15 08:21:47

标签: java android flash

我的Android应用程序需要播放.swf文件,这些文件只有声音..是否有插件或其他东西,所以我可以正常播放它们?感谢。

1 个答案:

答案 0 :(得分:0)

这是完美的解决方案::

package com.adySol;

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

public class adySol extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);



     String url ="file:///android_asset/mulberrybush.swf";
    // String url ="http://www.bing.com/";
 WebView wv=(WebView) findViewById(R.id.webView1);
 wv.getSettings().setJavaScriptEnabled(true);
    wv.getSettings().setPluginState(PluginState.ON);
    wv.getSettings().setAllowFileAccess(true); 
 wv.loadUrl(url);

}
}

<强> main.xml中

<?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="fill_parent"
android:background="@android:color/white"
>
<WebView android:id="@+id/webView1" android:layout_width="match_parent"  android:layout_height="match_parent"></WebView>

 </LinearLayout>