Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;

import android.view.View;
import android.view.inputmethod.InputMethodManager;

public class Main {
    /**
     * Magic to close the soft keyboard.
     *
     * See http://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard
     *
     * @param context The context.
     * @param focusedView The focused view.
     */
    public static void closeSoftKeyboard(Context context, View focusedView) {
        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(focusedView.getWindowToken(), 0);
    }
}