Android 在应用程序启动时播放.swf
我希望在android用户单击应用程序图标并启动应用程序时播放.swf文件,然后我希望启动应用程序的活动。以下是我的想法和我迄今为止所做的事情Android 在应用程序启动时播放.swf,android,flash,splash-screen,Android,Flash,Splash Screen,我希望在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.
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拾取 startActivity(yes_krao)
在您加载WebView
后立即被调用,因此应用程序将在.swf有机会玩之前切换活动。一种解决方案是在.swf文件的持续时间之后实现一个和切换活动
例如:
请注意,setPluginsEnabled()已被弃用,因此您应该使用setPluginState():
WebSettings webSettings = yourWebView.getSettings();
webSettings.setPluginState(PluginState.ON);
startActivity(yes_krao)
在您加载WebView
后立即被调用,因此应用程序将在.swf有机会玩之前切换活动。一种解决方案是在.swf文件的持续时间之后实现一个和切换活动
例如:
请注意,setPluginsEnabled()已被弃用,因此您应该使用setPluginState():
WebSettings webSettings = yourWebView.getSettings();
webSettings.setPluginState(PluginState.ON);
将WebView代码移到处理程序上方(请参见我编辑的答案),这样代码将首先被调用,然后在SPLASH_TIME_OUT之后调用意图并更改活动。最后一件事,先生。该文件位于资产文件夹??我访问它的方式正确吗??因为我看到一个白色屏幕,显示已设置的持续时间,然后主活动开始。未播放.swf文件!这可能与此有关。。。或者将WebView代码移到处理程序上方(请参见我编辑的答案),这样代码将首先被调用,然后在SPLASH_TIME_OUT之后调用意图并更改活动。最后一件事,先生。该文件位于资产文件夹??我访问它的方式正确吗??因为我看到一个白色屏幕,显示已设置的持续时间,然后主活动开始。未播放.swf文件!这可能与此有关。。。或