Page 264 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 264

TableLayout  database;
            DataBase  db;



            @Override
            protected  void  onCreate(Bundle  savedInstanceState)  {
            setContentView(R.layout.database_layout);
            super.onCreate(savedInstanceState);

            database  =  (TableLayout)  findViewById(R.id.table_layout);
            db=  new  DataBase(getApplicationContext(),"home.db",null,1);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            ArrayList<SmartHome>  list=  db.getResult();
            for(int  i=0;i<list.size();i++)
            {

            SmartHome  home  =  list.get(i);
            TableRow  row=  new  TableRow(this);
            row.setGravity(View.TEXT_ALIGNMENT_CENTER);
            TextView  no  =  new  TextView(this);

            TextView  goods  =  new  TextView(this);
            TextView  status  =  new  TextView(this);
            TextView  time  =  new  TextView(this);
            row.setLayoutParams(new
              V iewG roup.LayoutParams(View Grou p.Layo ut Para ms.M ATCH_PA R ENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

            no.setText(home.getA());
            goods.setText(home.getB());
            status.setText(home.getC());
            DateTime           dateTime           =          new          DateTime(home.getD().getTime(),

            DateTimeZone.forOffsetHours(9));
            time.setText(dateTime.toString("yy??m??d??h??M遺?s珥?));
            row.addView(no);
            row.addView(goods);
            row.addView(status);
            row.addView(time);

            database.addView(row);


            }







                                                         -  257  -
   259   260   261   262   263   264   265   266   267   268   269