Since long I have been struggling to convert .swf file to .apk file and the best part is I have the solution !!
Even I was searching around the internet for the solution ,and the outcome was obvious none of the methods worked !!! And I believe there are no tools yet that convert .swf to .apk directly.
Most Important !! The phone should be flash player enabled for the apk to work or else just a white screen would appear if the phone isnt flash enabled.
So after so many trials and errors I came out with a solution and it worked perfectly !!
Without any wasting any time lets get started !!
Create an android project eclipse and just include the code !
Here is code.
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class MainActivity 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/Flash.swf"; //Include your swf file here.
WebView wv=(WebView) findViewById(R.id.web_engine);
wv.getSettings().setPluginsEnabled(true);
wv.loadUrl(url);
}
}
XML code
Just replace the main.xml with the following code.
You can use any layouts of your choice, I have used absolute layout.
Its pretty straight forward.
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<WebView android:id="@+id/web_engine"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</WebView>
</AbsoluteLayout>
Thats it !!
Run the project !
Your APK is Ready ! Do comment !
Happy Coding !