My MainActivity extends activity and I use getContext()
in another class that has a instance of MainActivity passed in and it works fine there, my code:
convertView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.nowview, parent, false);
Class constructor:
public PictureCard(String url, String title, int index,
int pos, MainActivity parent)
{
this.parent = parent;
// ...
}
How I call the class
Card newCard = new PictureCard(links.get(index) , titles.get(index),
index, position, parent);
(Parent is passed in as this from the MainActivity class)