Android show soft keyboard when fragment onResume -
i trying show keyboard when screen edittext in foreground.. found 2 solutions, surprisingly, both work on cases , not other..
i have 2 fragments, first fragment shows keyboard when call showsoftkeyboard1 , second fragment works if call showsoftkeyboard2. both called inside onresume();
public static void showsoftkeyboard1(context activity, view view) { if (view == null) return; view.requestfocus(); inputmethodmanager imm = (inputmethodmanager) activity.getsystemservice(context.input_method_service); imm.showsoftinput(view, inputmethodmanager.show_forced); } public static void showsoftkeyboard2(activity activity, view view) { if (view == null) return; if (view.requestfocus()) { activity.getwindow().setsoftinputmode( windowmanager.layoutparams.soft_input_state_always_visible); } }
i wonder difference between these 2 methods?!
Comments
Post a Comment