0

i try this code to get the string from strings.xml using variable name. It's working perfectly but i want to access string-array in xml using variable bt it's not working. Any Help would be appreciated

    String name = "app_name";
    int identifier = getResources().getIdentifier (name,"string","com.example.saa.quotes");
    if (identifier!=0){
        array=getResources().getString(identifier);
        Toast.makeText(this, array, Toast.LENGTH_SHORT).show();
    }
    else{
        array=null;//or null or whatever
        Toast.makeText(this, "Could not able to acces the Data", Toast.LENGTH_SHORT).show();
    }
Gowthaman M
  • 8,057
  • 8
  • 35
  • 54

0 Answers0