This repository was archived by the owner on Jun 27, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
app/src/main/java/com/blogspot/e_kanivets/moneytracker/fragment Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 11package com .blogspot .e_kanivets .moneytracker .fragment ;
22
33import android .app .Activity ;
4+ import android .content .Context ;
45import android .os .Bundle ;
56import android .support .v4 .app .Fragment ;
67import android .support .v7 .app .ActionBar ;
1112import android .view .MenuItem ;
1213import android .view .View ;
1314import android .view .ViewGroup ;
15+ import android .view .ViewTreeObserver ;
16+ import android .view .inputmethod .InputMethodManager ;
1417import android .widget .ArrayAdapter ;
1518import android .widget .EditText ;
1619import android .widget .Spinner ;
@@ -169,6 +172,11 @@ private void initViews(final View rootView) {
169172 }
170173 }
171174 }
175+
176+ /* Show keyboard and set focus on etTitle */
177+ InputMethodManager inputMethodManager = (InputMethodManager ) getActivity ().getSystemService (Context .INPUT_METHOD_SERVICE );
178+ inputMethodManager .toggleSoftInput (InputMethodManager .SHOW_FORCED , InputMethodManager .HIDE_IMPLICIT_ONLY );
179+ etTitle .requestFocus ();
172180 }
173181 }
174182
Original file line number Diff line number Diff line change @@ -170,6 +170,11 @@ private void initViews(final View rootView) {
170170 }
171171 }
172172 }
173+
174+ /* Show keyboard and set focus on etTitle */
175+ InputMethodManager inputMethodManager = (InputMethodManager ) getActivity ().getSystemService (Context .INPUT_METHOD_SERVICE );
176+ inputMethodManager .toggleSoftInput (InputMethodManager .SHOW_FORCED , InputMethodManager .HIDE_IMPLICIT_ONLY );
177+ etTitle .requestFocus ();
173178 }
174179 }
175180
You can’t perform that action at this time.
0 commit comments