Android之記賬本

來源:互聯網
上載者:User

標籤:

ColaBox記事本從登記收入與開支跳轉到賬單頁面運用了SQL錄入,表的結構為:

db.execSQL("CREATE TABLE bills ("                    + "_id INTEGER primary key autoincrement,"//ID                    +" acctitemid integer,"//賬目類型                       + "fee integer,"//費用                    + "userid integer,"//使用者                    + "sdate TEXT,"//日期                    + "stime TEXT,"//時間                    + "desc TEXT"    //  備忘                              + ");");
主類ColaBox:
package com.cola.ui;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.util.Log;import android.view.KeyEvent;import android.widget.ImageView;import android.widget.TextView;public class ColaBox extends Activity {    private Handler mHandler = new Handler();    ImageView imageview;    TextView textview;    int alpha = 255;    int b = 0;    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.main);        imageview = (ImageView) this.findViewById(R.id.ImageView01);        textview = (TextView) this.findViewById(R.id.TextView01);        Log.v("ColaBox", "ColaBox start ...");        imageview.setAlpha(alpha);        new Thread(new Runnable() {            public void run() {                initApp();                                while (b < 2) {                    try {                        if (b == 0) {                            Thread.sleep(1000);                            b = 1;                        } else {                            Thread.sleep(50);                        }                        updateApp();                    } catch (InterruptedException e) {                        e.printStackTrace();                    }                }            }        }).start();        mHandler = new Handler() {            @Override            public void handleMessage(Message msg) {                super.handleMessage(msg);                imageview.setAlpha(alpha);                imageview.invalidate();            }        };    }    public void updateApp() {        alpha -= 5;        if (alpha <= 0) {            b = 2;            Intent in = new Intent(this, com.cola.ui.Frm_Addbills.class);            startActivity(in);            this.finish();        }        mHandler.sendMessage(mHandler.obtainMessage());    }        public void initApp(){         BilldbHelper billdb=new BilldbHelper(this);           billdb.FirstStart();                     billdb.close();                          }    public boolean onKeyDown(int keyCode, KeyEvent event) {        Log.v("cola", "keycode=" + keyCode);        switch (keyCode) {        case KeyEvent.KEYCODE_BACK:            Log.v("ColaBox", "ColaBox end ...");            return true;                    }        return false;    }}

 

運行效果:

Android之記賬本

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.