我在我的项目的资产文件夹中有我的 .swf 文件。这是在跳入主要活动之前尝试在应用程序启动时运行该 .swf 文件的代码:
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);
}
}
当我单击我的 android 设备上的应用程序图标时,会在定义的时间内出现白屏,并且应用程序会跳转到主要活动。无法弄清楚为什么 .swf 文件不能自己播放!