我想在用户点击程序图标时,程序开启时播放 .swf 文件,然后我想开启程序的 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);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
String localUrl ="file:///android_asset/Kiss-o-meter.swf";
WebView wv=(WebView) findViewById(R.id.webview);
wv.getSettings().setPluginState(PluginState.ON);
wv.loadUrl(localUrl);
Intent yes_krao = new Intent(Splash_Screen.this, KissingMeter.class);
startActivity(yes_krao);
finish();
}
}, SPLASH_TIME_OUT);
}
xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
上面的代码有什么错误啊?好像没有执行, setPluginsEnabled(true);
也没有在eclipse 中运行。