• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

the keyboard not show in eclipse emulator

iraqy

Lurker
hi all
I am new in androed , I downloaded last eclipse and when I use the edittext the keyboard not show , what I do??
and this the code
[HIGH]
package com.example.mm;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnKeyListener;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity implements OnKeyListener {
EditText editText1;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText1 = (EditText) findViewById(R.id.editText1);
editText1.setOnKeyListener(this);
EditText editText2 = (EditText) findViewById(R.id.editText2);
editText2.setOnKeyListener(this);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText1, InputMethodManager.SHOW_IMPLICIT);
}
public boolean onKey(View view, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN)
{
editText1.setText("hello");
}
return false; // pass on to other listeners.
}
}
[/HIGH]
and the result that occur in emulator in attach files
 

Attachments

  • w.jpg
    w.jpg
    37.8 KB · Views: 63
Back
Top Bottom