-2

i have my .swf file in the assets folder of my project. here is the code from which am trying to run that .swf file on application startup before jumping into main activity:

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

public class Splash_Screen extends Activity {

     private static int SPLASH_TIME_OUT = 3000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.startup);

        String localUrl ="file:///android_asset/Kiss-o-meter.swf";

        WebView wv=(WebView) findViewById(R.id.webview);
        wv.getSettings().setPluginState(PluginState.ON);
        wv.loadUrl(localUrl); 

        new Handler().postDelayed(new Runnable() {

            /*
             * Showing splash screen with a timer. This will be useful when you
             * want to show case your app logo / company
             */

            @Override
            public void run() {
                // This method will be executed once the timer is over
                // Start your app main activity      
                Intent yes_krao = new Intent(Splash_Screen.this, KissingMeter.class);
                startActivity(yes_krao);
                finish();
            }
        }, SPLASH_TIME_OUT);
    }   
}

When i click the application icon on my android device a white screen comes up for the defined time and the application jumps into main activity. Ain't able to figure out why the .swf file is not playing itself!

Baba
  • 63
  • 2
  • 10

1 Answers1

0

According to this Question, i used to load the swf file instead of loading a html.

its work like a charm.

Add to AndroidManifest.xml

android:hardwareAccelerated="true"

2.

String url ="file:///android_asset/flash_file.swf";
oWebView = (WebView) findViewById(R.id.wvhPlayer);
oWebView.getSettings().setJavaScriptEnabled(true);
oWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
oWebView.loadUrl(url);
Community
  • 1
  • 1
Basbous
  • 3,927
  • 4
  • 34
  • 62
  • could u please re-edit your answer?? can you please tell me how ill load my .swf file?? – Baba Sep 25 '13 at 08:05