@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); db = new DbOpenHelper(this); database = db.getReadableDatabase(); Intent from = this.getIntent(); tableName = from.getStringExtra("contestTable"); db.subOnCreate(database, tableName); final Intent list = new Intent(this, MakeActivity.class); list.putExtra("contestTable", tableName); Button bMake = (Button) findViewById(R.id.bt_make); bMake.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startActivity(list); } }); Button bBackSlide = (Button) findViewById(R.id.bt_backToSlide); bBackSlide.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); tList = new ArrayList<String>(); adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, tList); String sql = "SELECT * FROM " + tableName; try { // 해당 공모전 안에 있는 teamList 보여주기 Cursor cursor = database.rawQuery(sql, null); cursor.moveToFirst(); while (!cursor.isAfterLast()) { int id = cursor.getInt(0); String needPerson = cursor.getString(1); Log.d("Team List ", "index= " + id + " needPerson=" + needPerson); // Log tList.add(needPerson); cursor.moveToNext(); } cursor.close(); } catch (Exception e) { Log.d("Team List in kangwon", "error in setAddress : " + e.toString()); } teamListView = (ListView) findViewById(R.id.teamList); teamListView.setAdapter(adapter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_slide); mDbOpenHelper = new DbOpenHelper(this); try { mDbOpenHelper.open(); mDbOpenHelper.insertColumn("국민클라우드"); mDbOpenHelper.insertColumn("세종시"); mDbOpenHelper.insertColumn("노인복지"); } catch (SQLException e) { e.printStackTrace(); } ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); viewPager.setAdapter(new FragmentAdapter(getSupportFragmentManager())); // 뷰페이저에 새로운 프레그먼트 삽입 }