Android Programming Tutorials

(Romina) #1
Life and Times

break;


case R.id.take_out:
current.setType("take_out");
break;


case R.id.delivery:
current.setType("delivery");
break;
}


adapter.add(current);
}
};


private AdapterView.OnItemClickListener onListClick=new
AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent,
View view, int position,
long id) {
current=model.get(position);


name.setText(current.getName());
address.setText(current.getAddress());
notes.setText(current.getNotes());


if (current.getType().equals("sit_down")) {
types.check(R.id.sit_down);
}
else if (current.getType().equals("take_out")) {
types.check(R.id.take_out);
}
else {
types.check(R.id.delivery);
}


getTabHost().setCurrentTab( 1 );
}
};


private Runnable longTask=new Runnable() {
public void run() {
for (int i=progress;
i< 10000 && isActive.get();
i+= 200 ) {
doSomeLongWork( 200 );
}


if (isActive.get()) {
runOnUiThread(new Runnable() {
public void run() {
setProgressBarVisibility(false);
progress= 0 ;
}


84
Free download pdf