I want the image path from the drawable under resources as a string but it shows error . But I can't identify what the error is. I provide some code snippet.
listView = view.findViewById(R.id.listView); ArrayList<Card> list = new ArrayList<>(); //here the error String img = "drawable://" + R.drawable.tiger; Note: when I placed image name (tiger) it gives me error
list.add(new Card("drawable://" + R.drawable.tiger, "Royal Bengal Tiger"));
"drawable://"? Do you want to access the drawable using name string?ImageLoaderfor example.