my Android application needs to play .swf files, which are sound only.. Is there a plugin or something so I can play them normally? Thanks.
Asked
Active
Viewed 708 times
-1
-
http://stackoverflow.com/questions/1887758/playing-a-flash-file-in-android – marto Jul 15 '11 at 08:27
1 Answers
0
Here is perfect solution ::
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>

Nikunj Patel
- 21,853
- 23
- 89
- 133
-
Thanks for the answer, it worked, though, when playing a normal .mp3 in the MediaPlayer, the cpu load is ~0%. though, using this to play .swf uses ~6% of the cpu. why is that? another question: will this also work on phones that are before 2.1 (that are 1.5/1.6)? – Omar Jul 15 '11 at 09:13
-
-
-
no . basically there are adobe player must require 2.2 version and old do cant. – Nikunj Patel Jul 15 '11 at 09:23