Reputation: 459
I'm trying to set up a custom actionbar mimicking the Google calendar actionbar based on Simon Jackson's answer to an SO question here.
However, I'm struggling with 'mContext' as I don't know what context it is referring to.
There are 2 instances of mContext, 1 when inflating the View and 2 when instantiating the actionbar. I've tried both the application context and inflater context but although each works for one mContext instance, neither works for both.
In the context of this code fragment, what is mContext?
I'm developing using Android Studio and API 22.
Upvotes: 0
Views: 32
Reputation: 2785
Add this before you call onCreate()
:
Context mContext;
Or preferably as suggested above,replace mContext
with getApplicationContext()
Upvotes: 0
Reputation: 3118
mContext would be referencing the:
getApplicationContext()
call from the Activity
Upvotes: 1