1
I’m having a little problem and I’m not making it. The problem is this: I have a Fragment in my app, and I want to fire a notification from it. The line I’m having problems with is this: NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
The mistake is in the getSystemService()
, IDE tells me that "The method getSystemService(String)
is Undefined for the type MinhaClasseFragment
"
I’ve tried to take and put together contexts, even use one Context
receiving getActivity()
and nothing.
I searched the web and couldn’t find anything to help me. What to do?
Notificationmanager mNotificationManager = (Notificationmanager) getActivity(). getSystemService(Context.NOTIFICATION_SERVICE); .
– Helder
Gee, I didn’t think of it! Thanks, Helder. I’m still Rookie on Android rs
– igorfeiden
@Helder posts his answer in answer form. So the OP can accept it and everyone will know that the problem is solved. Plus you can earn reputation for it.
– Math
@Helder Yes, do it :)
– igorfeiden