Пример #1
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.playerview);
    handview = (PortraitHandView) findViewById(R.id.handview);

    // handview = new PortraitHandView(this);
    // setContentView(handview);

    if (savedInstanceState != null) {
      CardView[] cards = (CardView[]) savedInstanceState.getSerializable("cards");
      if (cards != null) {
        for (CardView c : cards) {
          handview.addCard(c.getName(), c.getDescription());
        }
      }
    } else {
      @SuppressWarnings("unchecked")
      ArrayList<Card> cards = (ArrayList<Card>) getIntent().getSerializableExtra(EXTRA_CARDS);
      if (cards != null) {
        for (Card c : cards) {
          handview.addCard(c.getWord(), c.getDescription());
        }
      }
      Card adjective = (Card) getIntent().getSerializableExtra(EXTRA_ADJECTIVE);
      TextView adjView = (TextView) findViewById(R.id.adj);
      adjView.setText(adjective.getWord());
    }
  }
Пример #2
0
 @Override
 public void onSaveInstanceState(Bundle b) {
   b.putSerializable("cards", handview.getCards());
 }