I'm using a fragment for map which I'll use in main activity. But when I pass getContext() as argument, this is not working and showing me the following error. Please help to get rid of this.enter image description here
Asked
Active
Viewed 710 times
-1
-
you should use `getActivity()`. See [here](http://stackoverflow.com/a/14161920/) – Kidus Apr 08 '17 at 12:39
-
you should be using getActivity, try to search before posting question – Raut Darpan Apr 08 '17 at 12:41
-
1Use `import android.support.v4.app.Fragment;` – Enzokie Apr 08 '17 at 12:42
-
Thanks #Kidus & #Raut_Darpan – Mohsin Ahmed Apr 08 '17 at 12:44
-
I've already imported that one... #Enzokie – Mohsin Ahmed Apr 08 '17 at 12:45
1 Answers
1
You must use getActivity()
instead of getContext()
.

AlexTa
- 5,133
- 3
- 29
- 46
-
-
sorry, I was just looking my old questions... I don't know how to validate answer. – Mohsin Ahmed Oct 16 '18 at 18:06