0

I'm trying to call ((TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE).getSimOperatorName().toUpperCase(); to get the SIM carrier name from a fragment but I'm getting "cannot resolve method 'getSystemService(java.lang.String)' ", the same is working fine from an activity.

I'm trying to pass a Context to the fragment but it require an empty constructor. Any idea?

esQmo_
  • 1,464
  • 3
  • 18
  • 43
  • Oh sorry, I've just found the answer from there. StackExchange Androide app doesn't showing suggestion while typing question's title. Should be: `((TelephonyManager)getActivity().getSystemService(Context.TELEPHONY_SERVICE)).getSimOperatorName().toUpperCase();` – esQmo_ Mar 27 '17 at 03:55
  • telephonyManager = ( TelephonyManager )getActivity.getSystemService( Context.TELEPHONY_SERVICE ); – Remario Mar 27 '17 at 03:55

0 Answers0