我希望在 android 用户单击应用程序图标并且应用程序启动时播放 .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);
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
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捡起来!