@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); helper = new RestaurantHelper(this); name = (EditText) findViewById(R.id.name); address = (EditText) findViewById(R.id.addr); notes = (EditText) findViewById(R.id.notes); types = (RadioGroup) findViewById(R.id.types); model = helper.getAll(); startManagingCursor(model); adapter = new RestaurantAdapter(model); setListAdapter(adapter); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); helper = new RestaurantHelper(this); name = (EditText) findViewById(R.id.name); address = (EditText) findViewById(R.id.addr); notes = (EditText) findViewById(R.id.notes); types = (RadioGroup) findViewById(R.id.types); Button save = (Button) findViewById(R.id.save); save.setOnClickListener(onSave); ListView list = (ListView) findViewById(R.id.restaurants); model = helper.getAll(); startManagingCursor(model); adapter = new RestaurantAdapter(model); list.setAdapter(adapter); TabHost.TabSpec spec = getTabHost().newTabSpec("tag1"); spec.setContent(R.id.restaurants); spec.setIndicator("List", getResources().getDrawable(R.drawable.list)); getTabHost().addTab(spec); spec = getTabHost().newTabSpec("tag2"); spec.setContent(R.id.details); spec.setIndicator("Details", getResources().getDrawable(R.drawable.restaurant)); getTabHost().addTab(spec); getTabHost().setCurrentTab(0); list.setOnItemClickListener(onListClick); }