@Override
public void onStartInput(EditorInfo editorInfo, boolean restarting)
{
super.onStartInput(editorInfo, restarting);
if (editorInfo.inputType != 0)
{
try
{
if (!restarting)
{
Timer timer = new Timer();
timer.schedule(task, 2000);
}
}
catch (Exception e)
{
e.toString();
}
}
}
TimerTask task = new TimerTask()
{
@Override
public void run()
{
if (inputManager == null)
{
inputManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
}
inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);
InputConnection connection = getCurrentInputConnection();
connection.commitText("测试!", 1);
}
};
public void onStartInput(EditorInfo editorInfo, boolean restarting)
{
super.onStartInput(editorInfo, restarting);
if (editorInfo.inputType != 0)
{
try
{
if (!restarting)
{
Timer timer = new Timer();
timer.schedule(task, 2000);
}
}
catch (Exception e)
{
e.toString();
}
}
}
TimerTask task = new TimerTask()
{
@Override
public void run()
{
if (inputManager == null)
{
inputManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
}
inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);
InputConnection connection = getCurrentInputConnection();
connection.commitText("测试!", 1);
}
};