Я на моем проекте, и у меня есть проблемы с моим ListViewListView возвращает тот же элемент после первого выбора пункта
Вот код
public class shortstorymode extends ListActivity {
// Text read from file txt
String text = "";
String[] values = new String[] { "The Fox and The Crow", "The Giant and the traveller",
"The Mongoose", "The Pet Shop", "The Wind and The Sun"};
ArrayAdapter<String> adapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO Auto-generated method stub
adapter = new ArrayAdapter<String>(this,
R.layout.rowshortstorylayout, R.id.labelshortstory, values);
setListAdapter(adapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
String item = (String) getListAdapter().getItem(position);
//
// I will read data from file text in assets folder here
// to open what the text says, I have many text files to choose
// based on the item the user clicked
}
После того как я выбрать, например, " The Fox and The Crow ", он показывает макет с данными, считываемыми из файла« The Fox and The Crow.txt », затем я возвращаюсь к выбору другого элемента, макет показывает тот же текст ??? Зачем?? кто-то помогает
Заранее благодарен!
Вы можете разместить содержание onListItemClick? – Blackbelt
Не быть аккуратным уродом, но ваши классы должны начинаться с заглавной буквы, например ShortStoryMode, это просто «правило» –