how can i get a table based on another table position? in android

advertisements

I want to get an array based on another array click position like :

String[] nissanArray = getResources().getStringArray(R.array.nissan);
String name = nissanArray[pos];
int nameInt = Integer.parseInt("R.array." + name);
targetArray = getResources().getStringArray(nameInt);

and I got an error when using this : I believe the error starts from Line int ....


You can use the getIdentifier method of class android.content.res.Resources. See the documentation for the details.

It allows you to convert a resource name to the integer resource id.