会议时间:2016年3月30日  13:00~13:20

会议成员:冉华,张敏,王巍,夏一鸣。

会议目的:汇报前一天工作,全体成员评论,确定会后修改内容或分配下一步任务。

会议内容:

1.前端,完成功能点为“将获取信息转化为中端所需格式”,“发送获取的信息给中端”。以下是代码部分

  1 package com.onezero.account;
  2 
  3 import java.text.ParseException;
  4 import java.text.SimpleDateFormat;
  5 import java.util.Date;
  6 
  7 import com.onezero.account.controller.Account;
  8 import com.onezero.account.controller.AccountManager;
  9 import com.onezero.account.controller.AccountManagerImpl;
 10 
 11 import android.app.Activity;
 12 import android.os.Bundle;
 13 import android.util.Log;
 14 import android.view.Menu;
 15 import android.view.MenuItem;
 16 import android.view.View;
 17 import android.widget.Button;
 18 import android.widget.EditText;
 19 import android.widget.TextView;
 20 import android.widget.Toast;
 21 
 22 public class add extends Activity {
 23 
 24     @Override
 25     protected void onCreate(Bundle savedInstanceState) {
 26         super.onCreate(savedInstanceState);
 27         setContentView(R.layout.add_main);
 28         // 显示当前时间
 29         SimpleDateFormat formatter = new SimpleDateFormat(
 30                 "yyyy年MM月dd日    HH:mm:ss");
 31         Date curDate = new Date(System.currentTimeMillis());// 获取当前时间
 32         String str = formatter.format(curDate);
 33 
 34         TextView mTime = (TextView) findViewById(R.id.mytime);
 35         mTime.setText(str);
 36 
 37         // 实现事件类型选择,点击并改变显示。
 38         final TextView accounttype = (TextView) findViewById(R.id.accounttype);
 39         // 一般
 40         Button button1 = (Button) findViewById(R.id.button1);
 41         button1.setOnClickListener(new Button.OnClickListener() {
 42             public void onClick(View v) {
 43                 Button button1 = (Button) findViewById(R.id.button1);
 44                 accounttype.setText(button1.getText());
 45 
 46             }
 47         });
 48         // 餐饮
 49         Button button2 = (Button) findViewById(R.id.button2);
 50         button2.setOnClickListener(new Button.OnClickListener() {
 51             public void onClick(View v) {
 52                 Button button2 = (Button) findViewById(R.id.button2);
 53                 accounttype.setText(button2.getText());
 54 
 55             }
 56         });
 57 
 58         // 购物
 59         Button button3 = (Button) findViewById(R.id.button3);
 60         button3.setOnClickListener(new Button.OnClickListener() {
 61             public void onClick(View v) {
 62                 Button button3 = (Button) findViewById(R.id.button3);
 63                 accounttype.setText(button3.getText());
 64 
 65             }
 66         });
 67         // 交通
 68         Button button4 = (Button) findViewById(R.id.button4);
 69         button4.setOnClickListener(new Button.OnClickListener() {
 70             public void onClick(View v) {
 71                 Button button4 = (Button) findViewById(R.id.button4);
 72                 accounttype.setText(button4.getText());
 73 
 74             }
 75         });
 76         // 娱乐
 77         Button button5 = (Button) findViewById(R.id.button5);
 78         button5.setOnClickListener(new Button.OnClickListener() {
 79             public void onClick(View v) {
 80                 Button button5 = (Button) findViewById(R.id.button5);
 81                 accounttype.setText(button5.getText());
 82 
 83             }
 84         });
 85 
 86         // 医疗
 87         Button button6 = (Button) findViewById(R.id.button6);
 88         button6.setOnClickListener(new Button.OnClickListener() {
 89             public void onClick(View v) {
 90                 Button button6 = (Button) findViewById(R.id.button6);
 91                 accounttype.setText(button6.getText());
 92 
 93             }
 94         });
 95 
 96         Button button7 = (Button) findViewById(R.id.button7);
 97         button7.setOnClickListener(new Button.OnClickListener() {
 98             public void onClick(View v) {
 99                 OK();
100 
101             }
102         });
103 
104     }
105 
106     public boolean onCreateOptionsMenu(Menu menu) {
107         // Inflate the menu; this adds items to the action bar if it is present.
108         getMenuInflater().inflate(R.menu.add, menu);
109         return true;
110     }
111 
112     @Override
113     public boolean onOptionsItemSelected(MenuItem item) {
114         // Handle action bar item clicks here. The action bar will
115         // automatically handle clicks on the Home/Up button, so long
116         // as you specify a parent activity in AndroidManifest.xml.
117         
118         // 获取“录入”的返回键,并执行返回。
119         int id = item.getItemId();
120         if (id == R.id.action_add_back) {
121 
122             onBackPressed();
123         }
124 
125         return super.onOptionsItemSelected(item);
126     }
127 
128     // OK按钮
129     public void OK() {
130 
131         TextView mytime = (TextView) findViewById(R.id.mytime);
132         String text1 = mytime.getText().toString();
133 
134         TextView accounttype = (TextView) findViewById(R.id.accounttype);
135         String text2 = accounttype.getText().toString();
136 
137         EditText editText1 = (EditText) findViewById(R.id.editText1);
138         String text3 = editText1.getText().toString();
139     
140         EditText editText2 = (EditText) findViewById(R.id.editText2);
141         String text4 = editText2.getText().toString();
142         
143 
144         if (text3.equals("")) {
145 
146             Log.e("$%^", "toast");
147             Toast toast = Toast.makeText(add.this, "请输入金额。",
148                     Toast.LENGTH_SHORT);
149             toast.show();
150         }
151 
152         else if(text3.equals(".")||text3.substring(0, 1).equals("0")){
153             
154             Toast toast = Toast.makeText(add.this, "输入有误,请重新输入。",
155                     Toast.LENGTH_SHORT);
156             toast.show();
157             
158 
159             
160         }
161         
162         else{
163             
164             AccountManager accountManager = new AccountManagerImpl();
165             Account account = new Account();
166             account.setAccountId(1);
167             
168             try {
169                 account.setAccountDate(new SimpleDateFormat("yyyy年MM月dd日    HH:mm:ss").parse(text1));
170             } catch (ParseException e) {
171                 // TODO Auto-generated catch block
172                 e.printStackTrace();
173             }
174             
175             account.setAccountType(text2);
176             account.setAccountSum(text3);
177             accountManager.addAcount(account);
178             
179             onBackPressed();
180         }
181         
182         
183         
184 
185     }
186 
187 }
add.java

相关文章:

  • 2021-11-21
  • 2021-07-05
  • 2021-05-17
  • 2021-08-26
  • 2021-10-29
  • 2022-02-25
  • 2021-07-25
  • 2021-09-17
猜你喜欢
  • 2021-06-22
  • 2021-10-20
  • 2021-11-06
  • 2021-09-27
  • 2021-11-22
  • 2022-01-09
  • 2021-10-08
相关资源
相似解决方案