I have links in strings.xml , I have arraylist that contains R.string.web_something. How can I open intent taking int ,reference to strings.xml, with web link from arraylist?
places.add(new Places(R.string.dejavu,R.string.web_dejavu,R.drawable.dejavu,R.string.web_dejavu,R.string.location_dejavu));
Here I need to add code to open an Intent (webpage) using link from strings.xml
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
Places place = places.get(position); //after this
}
});
tried toString(); but couse place.getWebID() returns int, it doesnt work getWeb():
public int getWeb() {
return pWebID;
}
You can get the URL from your ArrayList which contains string resource
Resouce arrayList is of type Integer .So,
for(int i : yourResourceList)
String url = getString(i);
Just loop through the list and you will get each string URL in the list
Edit
In your case try
String place = getString(places.get(position).getWebID());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.