Via : OpenAndroid.in
Tags :
Orginal Post: Android How to get Activity from Context
Sometimes we pass context of an activity as a parameter to some other function and later we might want the activity too. So instead of passing the activity also to that function, we can get the activity from context itself.
Method 1
You can get the activity from the context by type casting the context to activity.
Activity activity = (Activity) _context; |
Reference : http://stackoverflow.com/questions/9891360/getting-activity-from-context-in-android
Source : AndroidHive
Via : OpenAndroid.in
Tags :
Orginal Post: Android How to get Activity from Context
0 comments:
Post a Comment