Page 97 - 3-3
P. 97

import java.util.ArrayList;                             // ArrayList


              public class DataBaseView extends Activity implements OnClickListener {


                      private boolean FinishFlag;
                      private String ips;
                      private int I, flag = 0;
                      private ImageButton light, home, del;
                      MyThread th;
                      private ArrayList<SaveLog> array;
                      TableLayout data;
                      DataBase db;


                      public void onCreate(Bundle savedInstanceState) {
                              requestWindowFeature(Window.FEATURE_NO_TITLE);
                              setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                              super.onCreate(savedInstanceState);
                              setContentView(R.layout.databaseview);


              getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);


                              db = new DataBase(getApplicationContext(), "log.db", null, 1);
                              home = (ImageButton) findViewByld(R.id.homeBtn);
                              light = (ImageButton) findViewByld(R.id.lightBtn);
                              del = (ImageButton) findViewByld(R.id.delBtn);
                              data = (TableLayout) findViewByld(R.id.data);
                              array = db.getLog();


                              light.setOnClickListener(this);
                              home.setOnClickListener(this);
                              del.setOnClickListenter(this);
                              getPreferences();


                              th = new MyThread(ips, 9999);
                              th.start();
                              flag = 1;


                              for (int j = 0; j < array.size(); j++) {
                                      SaveLog log = array.get(j);
                                      TableRow row = new TableRow(this);
                                      TextView view = new TextView(this);
                                      TextView view2 = new TextView(this);
                                      TextView view3 = new TextView(this);
                                      TextView view4 = new TextView(this);


                                                           - 97 -
   92   93   94   95   96   97   98   99   100   101   102