java
1public class FreeZooItemDialogFragment extends DialogFragment { 2--- 3 // リスト 4 ArrayList mItems = new ArrayList<>(); 5--- 6 7 @Override 8 public void onDismiss(DialogInterface dialog) { 9 Intent intent = new Intent(); 10 intent.putParcelableArrayListExtra("selected_items", mItems); 11 12 super.onDismiss(dialog); 13 }
java
1public class FreeZooActivity extends Activity { 2--- 3 4// インテント 5 Intent intent = getIntent(); 6 7 // レイアウト 8 FrameLayout layout = (FrameLayout) findViewById(R.id.free_zoo_root); 9 10 // 動物があるか 11 if (intent.hasExtra("selected_items")){ 12 ArrayList mItems = intent.getParcelableArrayListExtra("selected_items"); 13 14 for (int i = 0; i < ANIMAL_INDEX_MAX; i ++) { 15 16 if (mItems.get(i) != null) { 17 int itemNum = (int) mItems.get(i); 18 View view = getLayoutInflater().inflate(R.layout.selected_animals, null); 19 layout.addView(view); 20 21 ImageView animal0 = (ImageView) view.findViewById(R.id.selected_animals); 22 animal0.setImageResource(ANIMAL_LIST.get(itemNum).get("image")); 23 24 } 25 } 26 }
これで、addView()したはずのviewが表示されません。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/05/16 01:58