Back to project page android-mvc-framework.
The source code is released under:
Apache License
If you think the Android project android-mvc-framework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.android_mvc.sample_project.domain; /*from w w w . j a va 2 s. c o m*/ import android.app.Activity; import com.android_mvc.sample_project.activities.func_db.DBEditActivity; import com.android_mvc.sample_project.db.dao.FriendDAO; import com.android_mvc.sample_project.db.entity.Friend; import com.android_mvc.framework.controller.action.ActionResult; import com.android_mvc.framework.controller.action.BaseAction; import com.android_mvc.framework.controller.validation.ActivityParams; import com.android_mvc.framework.ui.UIUtil; /** * DB??????????BL? * @author id:language_and_engineering * */ public class DBEditAction extends BaseAction { private DBEditActivity activity; public DBEditAction(DBEditActivity activity) { this.activity = activity; } // BL?? @Override public ActionResult exec() { ActivityParams params = activity.toParams(); // ?????????????????????????? String name = (String)params.getValue("name"); Integer age = Integer.valueOf((String)params.getValue("age")); Boolean favorite_flag = (Boolean)params.getValue("favorite_flag"); // DB???????????????????????????????????????????DB????????????????? Friend f = new FriendDAO(activity).create( name, age, favorite_flag ); // ?????????? return new DBEDitActionResult() .setRouteId("success") .add("new_friend_name", f.getName()) .add("new_friend_obj", f) ; } // ??????????? static class DBEDitActionResult extends ActionResult { private static final long serialVersionUID = 1L; @Override public void onNextActivityStarted(final Activity activity) { UIUtil.longToast(activity, get("new_friend_name") + "????????????????????"); } } // NOTE: ???????????????exec???????????????????????????????????????????????????? // static?????????????????????????????????? // ????????Java?????????????Serializable?????????????? // @see http://d.hatena.ne.jp/language_and_engineering/20120313/p1 }