public class Util
{
public static void onHideKeyboard(Activity context)
{
try{
InputMethodManager imm = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm.isAcceptingText()) {
imm.hideSoftInputFromWindow(context.getCurrentFocus().getWindowToken(), 0);
} else {
//Log.e("Software Keyboard was not shown","no");
}
}catch(Exception e)
{
}
}
}
..........................
Call in Activity
String name="abcd@gmail.com";
public class MainActivity
extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_createaccount);
//Hide Keyboard in android
Util.onHideKeyboard(MainActivity.this);
}
}
{
public static void onHideKeyboard(Activity context)
{
try{
InputMethodManager imm = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm.isAcceptingText()) {
imm.hideSoftInputFromWindow(context.getCurrentFocus().getWindowToken(), 0);
} else {
//Log.e("Software Keyboard was not shown","no");
}
}catch(Exception e)
{
}
}
}
..........................
Call in Activity
String name="abcd@gmail.com";
public class MainActivity
extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_createaccount);
//Hide Keyboard in android
Util.onHideKeyboard(MainActivity.this);
}
}
No comments:
Post a Comment