团队计划
Posted 是你,就好
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了团队计划相关的知识,希望对你有一定的参考价值。
今天做了什么?
记账功能的实现
源代码:
1 package com.example.grouptext02; 2 3 4 5 6 7 import android.app.Activity; 8 import android.content.ContentValues; 9 import android.content.Intent; 10 import android.database.sqlite.SQLiteDatabase; 11 import android.os.Bundle; 12 import android.util.Log; 13 import android.view.View; 14 import android.view.View.OnClickListener; 15 import android.widget.Button; 16 import android.widget.EditText; 17 import android.widget.RadioButton; 18 import android.widget.RadioGroup; 19 import android.widget.Toast; 20 21 public class Record extends Activity { 22 23 String label; 24 String money; 25 String tview; 26 RadioGroup radiogroup; 27 RadioButton radiobutton1; 28 RadioButton radiobutton2; 29 RadioButton radiobutton3; 30 SQLiteDatabase db; 31 32 33 private RadioGroup.OnCheckedChangeListener mradiogroup = new RadioGroup.OnCheckedChangeListener() { 34 35 @Override 36 public void onCheckedChanged(RadioGroup group, int checkedId) { 37 // TODO Auto-generated method stub 38 Log.v("TAG","王大思的标记record.6"); 39 if(checkedId==radiobutton1.getId()) 40 { 41 tview="chi"; 42 } 43 else if(checkedId==radiobutton2.getId()) 44 { 45 tview="yule"; 46 } 47 48 else if(checkedId==radiobutton3.getId()) 49 { 50 tview="chuan"; 51 } 52 Log.v("TAG","王大思的标记record.7"); 53 } 54 }; 55 56 @Override 57 protected void onCreate(Bundle savedInstanceState) { 58 super.onCreate(savedInstanceState); 59 setContentView(R.layout.record); 60 Log.v("TAG","王大思的标记record.1"); 61 final EditText et2 =(EditText) findViewById(R.id.money_in); 62 63 radiogroup = (RadioGroup) findViewById(R.id.radiogroup1); 64 radiobutton1 = (RadioButton) findViewById(R.id.radiobutton1); 65 radiobutton2 = (RadioButton) findViewById(R.id.radiobutton2); 66 radiobutton3 = (RadioButton) findViewById(R.id.radiobutton3); 67 radiogroup.setOnCheckedChangeListener(mradiogroup); 68 69 Log.v("TAG","王大思的标记record.2"); 70 DataHelper helper = new DataHelper(getBaseContext()); 71 db = helper.getWritableDatabase(); 72 Log.v("TAG","王大思的标记record.3"); 73 74 75 Button Button = (Button) findViewById(R.id.button1); 76 Button.setOnClickListener(new OnClickListener() 77 { 78 public void onClick(View arg0) 79 { 80 money = et2.getText().toString(); 81 Toast.makeText(getBaseContext(),"1"+tview+"2"+money+"3", Toast.LENGTH_LONG).show(); 82 83 label = tview; 84 Log.v("TAG","王大思的标记record.4"); 85 ContentValues values =new ContentValues(); 86 values.put(DataHelper.MONEY, money); 87 values.put(DataHelper.LABEL, label); 88 89 90 91 92 db.insert(DataHelper.TABLENAME, null, values); 93 94 Log.v("TAG","王大思的标记record.5"); 95 Intent i = new Intent(Record.this,Mainpage.class); 96 startActivity(i);//跳转 97 } 98 }); 99 100 101 } 102 103 104 }
实现的功能,能够进行消费选项,还有金额输入
明天准备做什么?
进行界面布局的开发
遇到的困难:
单选框的使用
解决:如上文中代码,另建函数并用if else条件语句进行判断
以上是关于团队计划的主要内容,如果未能解决你的问题,请参考以下文章