ok so here is what i have so far
}
now im guessing that there is something wrong with this because whenever i click on an item in the list nothing happens. anyone know how to fix this or what im doing wrond? thanks.
package
list.view;
import
android.app.ListActivity;
import
android.os.Bundle;
import
android.view.View;
import
android.widget.ArrayAdapter;
public
class ListView extends ListActivity {
/** Called when the activity is first created. */
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, ANIONS));
}
public static final String[] ANIONS = new String[] {
"Acetate", "Bromine", "Carbonate", "Chlorate", "Chloride",
"Chlorite", "Chromate", "Cyanide", "Dychromate",
};
protected void onListItemClick(ListView l, View v, int position,long id)
{
if (position == 0){
setContentView(R.layout.acetate);
};
if (position == 1){
setContentView(R.layout.bromine);
};
if (position == 2){
setContentView(R.layout.carbonate);
};
}
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, ANIONS));
}
public static final String[] ANIONS = new String[] {
"Acetate", "Bromine", "Carbonate", "Chlorate", "Chloride",
"Chlorite", "Chromate", "Cyanide", "Dychromate",
};
protected void onListItemClick(ListView l, View v, int position,long id)
{
if (position == 0){
setContentView(R.layout.acetate);
};
if (position == 1){
setContentView(R.layout.bromine);
};
if (position == 2){
setContentView(R.layout.carbonate);
};
}
}
now im guessing that there is something wrong with this because whenever i click on an item in the list nothing happens. anyone know how to fix this or what im doing wrond? thanks.