アプリでFragmentActivityを使用しています。アクセス中に1つのパネルが表示され、新しいアクティビティでリストが作成されますが、タブレットで実行すると、2つのパネルが表示されますが、2番目のパネルの読み込みを拒否します。
「ItemDetailFragment」はOnItemClickListenerを実装するFragmentActivtyであり、プロジェクトを作成したときは元々「Fragment」と入力されていました。
ItemListActivityに1つ、2つのエラーが発生します
if (mTwoPane) {
Bundle arguments = new Bundle();
arguments.putString(ItemDetailFragment.ARG_ITEM_ID, id);
//ItemDetailFragment fragment = new ItemDetailFragment();
ItemDetailFragment fragment = new ItemDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.replace(R.id.item_detail_container, fragment)
//The method replace(int, Fragment) in the type FragmentTransaction
//is not applicable for the arguments (int, ItemDetailFragment)
// Change type of 'fragment' to 'Fragment'
.commit();
} else {
Intent detailIntent = new Intent(this, ListUsers.class);
detailIntent.putExtra(ItemDetailFragment.ARG_ITEM_ID, id);
startActivity(detailIntent);
}
そして、「ItemDetailActivity」と「.add」のまったく同じエラーがエラーを引き起こします
Bundle arguments = new Bundle();
arguments.putString(ItemDetailFragment.ARG_ITEM_ID,
getIntent().getStringExtra(ItemDetailFragment.ARG_ITEM_ID));
ItemDetailFragment fragment = new ItemDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.item_detail_container, fragment)
.commit();
「Fragment」を使ったのはこれが初めてなので、何か提案をお願いします。