Search code examples
javaandroidstringtoast

Toast or string error


I want to show a message to the user that the max limit is 10k. My code:

Toast.makeText(getApplicationContext(), R.string.max_limit+"10000", Toast.LENGTH_SHORT).show();

If I delete the R.string.max_limit+ part it shows 10000 and when I delete the "10000" part it shows Max limit but when I put them together the outcome is this message "21355843649".


Solution

  • Try using :

    String result = getResources().getString(R.string.max_limit);
    Toast.makeText(getApplicationContext(),result+"10000", Toast.LENGTH_SHORT).show();
    

    Hope this helps