package vandy.mooc.utils;
import android.app.Activity;
import android.content.Context;
import android.os.IBinder;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
/**
* Useful helper methods and fields.
*/
public class Utils {
/**
* This method is used to hide a keyboard after a user has
* finished typing the url.
*/
public static void hideKeyboard(Activity activity,
IBinder windowToken) {
InputMethodManager mgr = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(windowToken, 0);
}
/**
* Show a toast message.
*/
public static void showToast(Context context,
String message) {
Toast.makeText(context,
message,
Toast.LENGTH_SHORT).show();
}
/**
* Make UtilsNet a utility class by preventing instantiation.
*/
private Utils() {
throw new AssertionError();
}
}