-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisplayAccount.java
89 lines (79 loc) · 2.92 KB
/
DisplayAccount.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.example.yash.expediturediary;
import android.database.Cursor;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
public class DisplayAccount extends AppCompatActivity
{
DbAccount db;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_account);
db=new DbAccount(this);
init();
}
public void init() {
db.open();
Cursor c=db.getAllInfo();
//Cursor c=db.getbyMonth();
TableLayout stk = (TableLayout) findViewById(R.id.table_main);
TableRow tbrow0 = new TableRow(this);
TextView tv0 = new TextView(this);
tv0.setText(" Sl.No ");
tv0.setTextColor(Color.WHITE);
tv0.setGravity(Gravity.CENTER);
tbrow0.addView(tv0);
TextView tv1 = new TextView(this);
tv1.setText(" Date ");
tv1.setTextColor(Color.WHITE);
tv1.setGravity(Gravity.CENTER);
tbrow0.addView(tv1);
TextView tv2 = new TextView(this);
tv2.setText(" Cause ");
tv2.setTextColor(Color.WHITE);
tv2.setGravity(Gravity.CENTER);
tbrow0.addView(tv2);
TextView tv3 = new TextView(this);
tv3.setText(" Amount in rs");
tv3.setTextColor(Color.WHITE);
tv3.setGravity(Gravity.CENTER);
tbrow0.addView(tv3);
stk.addView(tbrow0);
if(c.moveToFirst())
{
do
{
//Toast.makeText(Display.this, "id :"+c.getString(0)+" Date : "+c.getString(1)+"Data :"+c.getString(2)+"Amt : "+c.getString(3), Toast.LENGTH_SHORT).show();
TableRow tbrow = new TableRow(this);
TextView t1v = new TextView(this);
t1v.setText(c.getString(0));
t1v.setTextColor(Color.WHITE);
t1v.setGravity(Gravity.CENTER);
tbrow.addView(t1v);
TextView t2v = new TextView(this);
t2v.setText(" "+c.getString(1)+"/"+c.getString(2)+"/"+c.getString(3)+" ");
t2v.setTextColor(Color.WHITE);
t2v.setGravity(Gravity.CENTER);
tbrow.addView(t2v);
TextView t3v = new TextView(this);
t3v.setText(" "+c.getString(4)+" ");
t3v.setTextColor(Color.WHITE);
t3v.setGravity(Gravity.CENTER);
tbrow.addView(t3v);
TextView t4v = new TextView(this);
t4v.setText(" "+c.getString(5)+" ");
t4v.setTextColor(Color.WHITE);
t4v.setGravity(Gravity.CENTER);
tbrow.addView(t4v);
stk.addView(tbrow);
}while(c.moveToNext());
}
db.close();
}
}