1
안드로이드 사용자가 응용 프로그램 아이콘을 클릭하고 응용 프로그램이 시작될 때 .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);
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에서 선택하지 않았습니다!
내 편집 코드를 참조하십시오. 당신이 말하는 방식입니까? – Baba
답변을 수락 할 수 있도록 체크하십시오 :) – Baba
WebView 코드를 Handler 위에 올려 놓으십시오 (편집 된 답변 참조). 그러면 코드가 먼저 호출되고 SPLASH_TIME_OUT 후에 Intent가 호출되고 Activity가 변경됩니다. – ashatte