Skip to main content

How to close or hide the android soft Keyboard

Solution:
You can force the android to close the virtual keyboard.
hideSoftInputFromWindow function to close the virtual keyboard


Code:
View myview = this.getCurrentFocus();
if (myview != null) {      InputMethodManager inm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    inm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}

Comments

Post a Comment

Popular posts from this blog

FlutterLoader.loadEntrypoint is deprecated. Use "FlutterLoader.load" instead. While run flutter for chrome

 Problem: "FlutterLoader.loadEntrypoint" is deprecated. Use "FlutterLoader.load" instead. The above error will show while run my flutter app in chrome. Solution: The error because entry point is not set in your flutter app. < script > window . addEventListener ( 'load' , function ( ev ) { // Download main.dart.js _flutter . loader . loadEntrypoint ({ serviceWorker : { serviceWorkerVersion : serviceWorkerVersion , }, Then replace with below code it will works. window . addEventListener ( 'load' , function ( ev ) { // Download main.dart.js _flutter . loader . load ({ serviceWorker : { serviceWorkerVersion : serviceWorkerVersion , },

Gradle sync error Error:Failed to resolve: com.android.support

The project was working Fine. But suddenly it throws the following error. app\build . gradle Error : Error : Failed to resolve : com . android . support : support - annotations : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : appcompat - v7 : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : customtabs : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : cardview - v7 : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : support - v4 : 27.0 . 1 Install Repository and sync project Error : Error : Failed to resolve : com . android . support : support - core - utils : 27.0 . 1 Install Repository and sync project Reason: It suddenly shows error because of Facebook has updated the SDK and removed suppor...

Flutter refresh my screen while some value change in my model

 Problem: Flutter refresh my screen while some value change in my model or in my data.How to achieve that. Solution: In your widget add the below code. Widget build ( BuildContext context ) { return ChangeNotifierProvider ( create : ( _ ) => model , child : Scaffold ( body : Consumer < ViewModel >( builder : ( context , viewModel , child ) { In your viewmodel after change the data call this notifyListeners ();