永久地将单元格添加到列表中

时间:2014-12-29 19:21:19

标签: android listview android-activity android-listview

这是我目前的代码:

gameListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            if(position == plusPosition) //when plusSign is clicked
            {

                someGame = new Game();  //instance of game class
                someGame.gameName = indicatedGameName;
                arrayOfGames.add(0, someGame);
                gameRowItem newGame = new gameRowItem(someGame.gameName);
                GameRowItem.add(0, newGame);
                adapter.notifyDataSetChanged();
                plusPosition++;


            }else{
                Intent toGamePlay = new Intent(ListOfGames.this, GamePlay.class);
                startActivity(toGamePlay);
            }


        }
    });

每当我离开此活动然后返回此活动时,添加的细胞就会消失。即使您离开活动,我如何让细胞保存?提前感谢您提供的任何帮助。

0 个答案:

没有答案