朝花夕拾-android 一個註冊新使用者時,多步填寫使用者資料的架構,-android使用者資料

來源:互聯網
上載者:User

朝花夕拾-android 一個註冊新使用者時,多步填寫使用者資料的架構,-android使用者資料

源碼地址:http://git.oschina.net/zj2012zy/Android-Demo/tree/master/AndroidDemo/setpregister

效果如下:

基本思路:

1、定義一個抽象類別:

RegisterStep
 1 public abstract class RegisterStep { 2     public interface OnNextActionListener { 3         void next(); 4  5         void submit(); 6     } 7  8     protected Activity mActivity; 9     protected Context mContext;10 11     private View mContentView;12 13     protected OnNextActionListener mOnNextActionListener;14 15     public RegisterStep(Activity activity, View contentView) {16         mActivity = activity;17         mContext = (Context) mActivity;18         mContentView = contentView;19 20         initViews();21         initEvents();22     }23 24     public abstract void initViews();25 26     public abstract void initEvents();27 28     public abstract boolean validate();29 30     public View findViewById(int id) {31         return mContentView.findViewById(id);32     }33 34     public void doPrevious() {35 36     }37 38     public void doNext() {39         mOnNextActionListener.submit();40     }41 42     public void nextAnimation() {43 44     }45 46     public void preAnimation() {47 48     }49 50     public void setOnNextActionListener(OnNextActionListener onNextActionListener) {51         mOnNextActionListener = onNextActionListener;52     }53 }

其中介面OnNextActionListener 中的submit函數用來執行設定好的資料提交。

其中的validate,用來檢測每一步的設定值是否合法。

2、定義一系列的具體設定的子類,StepOne,StepTwo....

詳情參見源碼。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.