I would like to use swf animations in my application. 1. Is it possible to do so without Adobe Flash Player installed, using a library for example? 2. If so, how? If not, is there a way to check that the player is installed or "mark" it as required? 3. Should it work on the emulator?
-
Found my answers here: http://stackoverflow.com/questions/4617138/detect-if-flash-is-installed-on-android-and-embed-a-flash-video-in-an-activity and here: http://stackoverflow.com/questions/5243261/integrating-embedding-flash-in-android-applications-possible – Asaf Pinhassi May 27 '12 at 18:30
1 Answers
Yes You can use swf animation on android, the way this works consist on:
creating an html page in wich you play the swf, then opening the html in a webview component
You should first check if Flash is installed this snippet can help you:
boolean flashInstalled = false;
try {
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
if (ai != null)
flashInstalled = true;
} catch (NameNotFoundException e) {
flashInstalled = false;
}
By using the PackageManager you can obtain the Application Info for the Flash Player package. It will throw an exception if such a package doesn't exist.
After that you can display a Flash video to play your animation within your Activity by embedding it within a WebView.
If your check in Part 1 returns false, best practice would be to hide your WebView and replace it with either an error message explaining the requirement for Flash, or better still, a link to download the Flash plugin from the Android Market.
yes you can test it on emulator after installing Flash app on it!!

- 31,226
- 9
- 68
- 81