I do open Keyboard on Button click and i store all keypress value in String but i am facing some problem like this

```
1. when i press CAPITAL keys then i will got 2 times char
2. when i press search and Menu button then also enter the key
3. some char i can't get like PIE

```

So please check this code and give me proper answer.
 My Code is :

```
package com.indianic.phykeyboard;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class KeyboardActivity extends Activity {
    EditText mEdit;
    Boolean key = false;

    Button mKey, mMon;
    String getvalue;
    InputMethodManager imm;
    StringBuilder stringBuilder;
    TextView value;
    String ch = "";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mKey = (Button) findViewById(R.id.openkey);

        value = (TextView) findViewById(R.id.value);

        mKey.setOnClickListener(new OnClickListener() {

            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.toggleSoftInput(0, 0);
                stringBuilder = new StringBuilder();
            }
        });

    }

    public boolean onKey(View v, int keyCode, KeyEvent event) {
        switch (keyCode) {
        case KeyEvent.KEYCODE_ENTER:
            return true;
        }
        return false;
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        Log.v("log_tag", "char : " + event.getUnicodeChar());

        if (event.getUnicodeChar() != 0) {
            int i = event.getUnicodeChar();
            ch = new Character((char) i).toString();
        }

        if (ch.length() > 0) {
            if (keyCode == KeyEvent.KEYCODE_DEL && stringBuilder.length() >= 1) {
                stringBuilder.delete(stringBuilder.length() - 1, stringBuilder
                        .length());
            } else if (keyCode != KeyEvent.KEYCODE_DEL
                    && keyCode != KeyEvent.KEYCODE_ENTER) {
                stringBuilder.append(ch);
            } else if (keyCode == KeyEvent.KEYCODE_SEARCH
                    || keyCode == KeyEvent.KEYCODE_MENU) {

            }
        }

        if (keyCode == KeyEvent.KEYCODE_BACK) {
            stringBuilder.delete(0, stringBuilder.length());
            finish();
        }

        String str = stringBuilder.toString().trim();
        value.setText(str);

        return false;
    }
}

```