I see there are a lot of examples in github where people are using such method:
String postKey = getRef(position).getKey();
But in my Android S
There is no such function as getRef
actually in Firebase API.
So far I've understood that you're trying to put an onItemClickListener
to your ListView
and you're trying to pass some key
to the ArticleDetailsActivity
. So I think, as you've populated the articleModel
list you can find the key in there.
So the modified code might look like this.
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
Intent intent = new Intent(getActivity(), ArticleDetailsActivity.class);
// Find the key in the list you've populated earlier.
String postKey = articleModel.get(position).getKey();
intent.putExtra(ArticleDetailsActivity.EXTRA_POST_KEY, postKey);
getActivity().startActivity(intent);
}
});