2016-05-11 6 views
-3

私はAndroidアプリケーションにデバイス固有の問題があります。イメージアイコンをクリックすると、新しいフラグメントがロードされますが、代わりにDashboardにナビゲートされます。サムスンのデュオデバイス以外のすべてのデバイスで正常に動作しています。OnClickボタンは、新しいフラグメントの代わりにダッシュボードに移動します。

@Override 
public void onClick(View v) 
{ 
    switch (v.getId()) 
    { 
     case R.id.add_deal: 
      Intent addDealIntent = new Intent(mContext, BaseFragmentActivity.class); 
      addDealIntent.putExtra("Merchant", merchantInfo); 
      addDealIntent.putExtra("FragmentClassName", AddDealFragment.class.getName()); 
      addDealIntent.putExtra("toolbarTitle", "Add Deal"); 
      mContext.startActivity(addDealIntent); 
      break; 
     case R.id.add_product: 
      Intent addProductIntent = new Intent(mContext, BaseFragmentActivity.class); 
      addProductIntent.putExtra("Merchant", merchantInfo); 
      addProductIntent.putExtra("Categories", mMerchantCategories); 
      addProductIntent.putExtra("SubCategories", mMerchantSubCategories); 
      addProductIntent.putExtra("SubSubCategories", mMerchantSubSubCategories); 
      addProductIntent.putExtra("SuperSubCategories", mMerchantSuperSubCategories); 
      addProductIntent.putExtra("FragmentClassName", AddProductFragment.class.getName()); 
      addProductIntent.putExtra("toolbarTitle", "Add Product"); 
      mContext.startActivity(addProductIntent); 
      break; 
     case R.id.dialog_button_cancel: 
      dismiss(); 
      break; 
     default: 
      break; 
    } 
    dismiss(); 
} 
+0

あなたの質問を編集して、コードタグ内のすべてのことをラップしてください。 '' –

+0

はもう少し説明が必要です。それは細かい残りのデバイスを動作させるのですか?あなたのXMLレイアウト構造。 – Sush

+0

はい、サムスンのデュオデバイスを除く他のすべてのデバイスでは問題なく動作しています。 –

答えて

0

startActivityメソッドを使用すると、アクチシティ間を移動することができます。次にフラグメントを変更する必要があります。

あなたの断片を変更するには、このコードを使用することができます:

// Create new fragment and transaction 
Fragment newFragment = new ExampleFragment(); 
FragmentTransaction transaction = getFragmentManager().beginTransaction(); 

// Replace whatever is in the fragment_container view with this fragment, 
// and add the transaction to the back stack if needed 
transaction.replace(R.id.fragment_container, newFragment); 
transaction.addToBackStack(null); 

// Commit the transaction 
transaction.commit(); 
+0

このソリューションを使用しようとしましたが、まだ同じ問題が発生しています –

+0

コードを試しましたが、それでも同じページに移動します –

関連する問題