???????Activity????????????????

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/splash">
</LinearLayout>

?????????????????????Splash???????????
??????????????????AppController???????????????Activity???????????????????????????????????????AppController.processEvent???????????????????????????????????????μ???????????AppController????Message?????????AppController?????Handler????????????????????

 

package com.bjcic.wkj;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
public class AppController extends Handler {
public AppController(AppModel appModel) {
super();
this.appModel = appModel;
}
/**
* Activity?л???????????????????????????????????????AppController???????????
* @param event
*/
public void processEvent(AppEvent event) {
switch (event.getEventId()) {
case AppEvent.EVE_SPLASH_END: // ??Splash?????????????
showMainActivity((Activity)event.getContext()?? event.getParams());
break;
default:
break;
}
}
/**
* ?????????????????????????????????AppController???????????
*/
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
}
/**
* ???Splash??沢???????????
* @param activity
* @param params
*/
private void showMainActivity(Activity activity?? Bundle params) {
Log.d("wkj"?? "activity=" + activity + "; c=" + MainActivity.class + "!");
Intent intent = new Intent(activity?? MainActivity.class);
activity.startActivity(intent);
activity.finish();
}
private AppModel appModel = null;
}