

Posted by EHXM. Posted in " 안드로이드/Tech Note "2010/06/08 22:16
public class ViewSwitcherExample extends ListActivity
implements OnClickListener {
//sample list items
static final String[] ITEMS = new String[]
{ "List Item 1", "List Item 2",
"List Item 3", "List Item 4",
"List Item 5", "List Item 6",
"List Item 7", "List Item 8",
"List Item 9", "List Item 10" };
//the ViewSwitcher
private ViewSwitcher switcher;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//no window title
requestWindowFeature(Window.FEATURE_NO_TITLE);
//create the ViewSwitcher in the current context
switcher = new ViewSwitcher(this);
//footer Button: see XML1
Button footer = (Button)View.inflate(this, R.layout.btn_loadmore, null);
//progress View: see XML2
View progress = View.inflate(this, R.layout.loading_footer, null);
//add the views (first added will show first)
switcher.addView(footer);
switcher.addView(progress);
//add the ViewSwitcher to the footer
getListView().addFooterView(switcher);
//add items to the ListView
setListAdapter(new ArrayAdapter(this,
android.R.layout.simple_list_item_1, ITEMS));
}
@Override /* Load More Button Was Clicked */
public void onClick(View arg0) {
//first view is showing, show the second progress view
switcher.showNext();
//and start background work
new getMoreItems().execute();
}
/** Background Task To Get More Items**/
private class getMoreItems extends AsyncTask {
@Override
protected Object doInBackground(Void… params) {
//code to add more items
//...
try {
Thread.sleep(3000); //only to demonstrate
} catch (InterruptedException e) {
e.printStackTrace();
}
return null;
}
@Override /* Background Task is Done */
protected void onPostExecute(Object result) {
//go back to the first view
switcher.showPrevious();
//update the ListView
}
}
}
여러분의 커뮤니케이션을 기다리고 있습니다.

아이디어의 전쟁의 현장이었던 2010년 대한민국 매쉬업 경진대회에 다녀왔습니다. 이번 대회는 지난 2월 6일(토요일), 삼성동 코엑스 컨퍼런스룸 401에서 열렸습니다. 이번.....
2010년에 100가지가 넘는 안드로이드 폰 출시가 될 예정입니다. Mobile World Congress keynote에서 Google CEO Eric Schmidt의 연설.....
서울, 안양, 부산, 대구, 광주, 대전에 안드로이드 폰 체험 할 수 있는 곳이 있네요. 저는 코엑스 메가박스 입구에 있는 모토로라 체험 부스에서 우연히 모토로이를 만져보게 되.....
위 3D 갤러리는 http://www.fotoviewr.com/ 사이트의 Fotoviewr 입니다. Flex와 Papervision3D를 이용하여 위와같은 3D 갤러리를 구현해.....
Total : 115,871 Today : 227 Yesterday : 155