Reputation: 373
public void onClick(View v) {
//referenceOfActivity
// here is the context, don't know how to use it to get ActionBar title
Toast.makeText(referenceOfActivity,"Already Liked",Toast.LENGTH_SHORT).show();
}
I want to get the title of action bar within an adapter class. As you can see I have the Context of Activity.
Upvotes: 1
Views: 572
Reputation: 561
Cast your activity name to your context. Example;
((MainActivity) referenceOfActivity).getSupportActionBar().getTitle()
Upvotes: 4