List of usage examples for android.app Activity getSystemService
@Override
public Object getSystemService(@ServiceName @NonNull String name)
From source file:Main.java
public static void hideKeyboard(Activity a) { ((InputMethodManager) a.getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(a.getWindow().getDecorView().getWindowToken(), 0); }
From source file:Main.java
public static void showKeyboard(Activity a) { ((InputMethodManager) a.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }
From source file:Main.java
public static String getMyPhoneImei(Activity _act) { return ((TelephonyManager) _act.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); }
From source file:Main.java
public static String getMyPhoneNumber(Activity _act) { return ((TelephonyManager) _act.getSystemService(Context.TELEPHONY_SERVICE)).getLine1Number(); }
From source file:Main.java
/** * Utility method that returns and AudioManager for the Activity passed in * @param activity the Activity that will be associated to the AudioManager * @return the AudioManager object for the passed Activity *///from w w w . j av a 2s . c om public static AudioManager setAudioManager(Activity activity) { return (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE); }
From source file:Main.java
public static void setSoftInputVisibility(Activity activity, int status) { ((InputMethodManager) activity.getSystemService("input_method")).toggleSoftInput(0, status); }
From source file:Main.java
public static void hideKeyBoard(Activity aty) { ((InputMethodManager) aty.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow( aty.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:Main.java
public static void showKeyBoard(Activity activity, View view) { ((InputMethodManager) activity.getSystemService(Service.INPUT_METHOD_SERVICE)).showSoftInput(view, 0); }
From source file:Main.java
public static void showInput(Activity activity, View view) { ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, 0); }
From source file:Main.java
public static String getPhoneIMEI(Activity aty) { TelephonyManager tm = (TelephonyManager) aty.getSystemService(Activity.TELEPHONY_SERVICE); return tm.getDeviceId(); }