Q:

Android fragment Application not working on mobile devices

My android application not working on mobile devices it just working on Samsung mobiles whole application running on samsung devices but not on other phone please help me out here is my code.
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    if (savedInstanceState == null) {
        Fragment newFragment = new MainPage();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.add(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    // TODO Auto-generated method stub
    if (getFragmentManager().getBackStackEntryCount() == 1) {

        switch (keyCode) {
            case KeyEvent.KEYCODE_BACK:
                AlertDialog.Builder ab = new AlertDialog.Builder(MainActivity.this);
                ab.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener)
                        .setNegativeButton("No", dialogClickListener).show();
                break;
        }
    }
    else {
        getFragmentManager().popBackStack();
    }

    return super.onKeyDown(keyCode, event);
}
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
        switch (which){
            case DialogInterface.BUTTON_POSITIVE:
                //Yes button clicked
                finish();
                break;

            case DialogInterface.BUTTON_NEGATIVE:
                //No button clicked
                break;
        }
    }
};

@Override
public void onBackPressed() {

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_home) {
        Fragment newFragment = new MainPage();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }

    return super.onOptionsItemSelected(item);
}

@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    FragmentManager fragmentManager = getFragmentManager();

    if (id == R.id.nav_trail) {
        Fragment newFragment = new TrailBalance();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    } else if (id == R.id.nav_profit) {
        Fragment newFragment = new ProfitAndLoss();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    } else if (id == R.id.nav_balance) {
        Fragment newFragment = new BalanceSheet();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }  else if (id == R.id.nav_cash) {
        Fragment newFragment = new CashFlow();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }  else if (id == R.id.nav_change) {
        Fragment newFragment = new ChangeInEquity();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }else if (id == R.id.nav_sale_detail) {
        Fragment newFragment = new SaleDetail();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }else if (id == R.id.nav_sale_summary) {
        Fragment newFragment = new SaleSummary();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }else if (id == R.id.nav_purchase_detail) {
        Fragment newFragment = new PurchaseDetail();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }else if (id == R.id.nav_purchase_summary) {
        Fragment newFragment = new PurchaseSummary();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }else if (id == R.id.nav_stock_detail) {
        Fragment newFragment = new StockDetail();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }else if (id == R.id.nav_stock_summary) {
        Fragment newFragment = new StockSummary();
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.content_fram, newFragment);
        ft.addToBackStack(null);
        ft.commit();
    }else if (id == R.id.nav_account_logout) {
        Intent intent = new Intent(MainActivity.this, Login.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        startActivity(intent);
        finish();
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
public static void launchFragment(Fragment fragment, Context context){
    FragmentManager fragmentManager = ((AppCompatActivity)context).getFragmentManager();
    FragmentTransaction ft = fragmentManager.beginTransaction();
    ft.addToBackStack(null);

    ft.replace(R.id.content_fram, fragment);
    ft.commit();
}}

Error in logcat is: Failed to inflate android.view.InflateException: Binary XML file line #30: Error inflating class              at android.view.LayoutInflater.createView(LayoutInflater.java:620)             at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56).
Please help me out. from this issue.

A:

This issue is you drawable image file use another file or folder for drawable or use small image resolution of your image.

