I tried a few solutions on stack overflow but they seem to not work for me.
I use the following onlongclicklistener
Object j = (Quote) MainActivity.this.adapter.getItem(position);
The following is my object J
Now I would like to get the value of ticker into a string
How do I go about this. Do I need a Hashmap ?
String valueofticker = j.toString(ticker); // How to do this ?
If the items inside the adapter is a list of Quote objects, then you could do this:
class Quote {
private String ticker;
// create getter and setter methods here for all
// the variables in the Quote class.
}
Get Quote using this:
Quote qObj = (Quote) MainActivity.this.adapter.getItem(position);
Get the ticker value like this:
String tickerValue = qObj.getTicker();
// the same will apply for all other variables of the class Quote.
Hope that helps!