title: How to run .swf Files on Android Device
body: <p>I am new to android and just started working on flash objects, by which i mean .swf files. I have read a lot about using a web view to load the swf file stored in assets/SD location, but to no avail. i have got suggestions from <a href="https://stackoverflow.com/questions/6106636/how-to-play-local-swf-files-in-a-webview">How to Play local swf files in a webview</a> , flash players, Adobe AIR features of setting an swf to make an apk, etc. But still i am not being able to run the .swf files satisfactorily, due to the following reasons :</p>
  
  <ol>
  <li><p>Even thought i set everything as set in the above link, i am getting a blank screen, much to my dismay of flash player not currently being default ("Launch by Default" Option in Setting->Apps->Flash Player->Launch By Default), hence i can't run flash content.</p></li>
  <li><p>I have applied Adobe AIR to actually get the apk of the swf file by following a lengthy process, but because of two reason : a) Very laborious process and b) per-Installation requirement of Adobe AIR makes the whole purpose a losing battle.</p></li>
  <li><p>Lots of Jargon/Confusion in Flash and lots of news on how flash is not making updates to its products for mobile sector, and how android "has"/"trying to" move into html 5.</p></li>
  </ol>
  
  <p>I would like you all to solve this remedy to get flash swf object running on Android with minimum plugin ad-dons to the browser. I would love to have the has less support files as possible for my work to be productive and educative as well.</p>
  
  <p>I hereby attach a code snippet, which i was working to get the work done to get the swf file running :</p>
  
  <ol>
  <li><p>Approach One :</p>
  
  <pre><code>    import android.annotation.SuppressLint;
      import android.app.Activity;
      import android.os.Bundle;
      import android.webkit.WebSettings;
      import android.webkit.WebView;
      import android.widget.LinearLayout;
  
      @SuppressLint("SetJavaScriptEnabled")
      public class SWFViewer extends Activity {
      WebView wvswf;
      LinearLayout linearLayout;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_swfviewer);
          linearLayout = (LinearLayout) findViewById(R.id.linearLayout);
          wvswf = new WebView(SWFViewer.this);
          wvswf.getSettings().setJavaScriptEnabled(true);
          wvswf.getSettings().setPluginState(WebSettings.PluginState.ON);
          wvswf.getSettings().setAllowFileAccess(true);
          linearLayout.addView(wvswf, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
  
      String Url = "file:///android_asset/main.swf";
      wvswf.loadUrl(Url);
  
          }
  
  }
  </code></pre></li>
  </ol>
  
  <p>With the layout as : </p>
  
  <pre><code>        &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.winit.nunna.swfviewer"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk android:minSdkVersion="8"
          android:maxSdkVersion="16" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="READ_EXTERNAL_STORAGE"/&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.winit.nunna.swfviewer.SWFViewer"
              android:label="@string/app_name"
              android:screenOrientation="landscape"
              android:theme="@android:style/Theme.NoTitleBar.Fullscreen" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <ol start="2">
  <li>Approach Two</li>
  </ol>
  
  <p>Using Adobe AIR SDK, we create an apk using the main swf file, some xml files for configuration and app signing, we can release an apk.</p>
  
  <p>Conclusion : The first is the easiest but no o/p </p>
  
  <pre><code>12-20 13:56:28.457: INFO/WindowManager(162): MediaPlayer.is not PlayingVideo
  </code></pre>
  
  <p>The later is cumbersome with lots of extra dependencies. </p>
  
  <p>Please give me better options to get an affordable aka high/moderate performance Flash O/p.</p>