haxe jni调用输入法

 public static void startInputDialog(final String title, final String text, final String buttonLabel, final HaxeObject callback) {
        final Activity activity = MainActivity.getInstance(); 
        activity.runOnUiThread(new Runnable() {
            @Override public void run() {
                final EditText edit = new EditText(MainActivity.getInstance());
                edit.setText(text);
                edit.setFocusable(true);
                edit.setFocusableInTouchMode(true);
                new AlertDialog.Builder(activity)
                        .setTitle(title)
                        .setView(edit)
                        .setPositiveButton(buttonLabel, new DialogInterface.OnClickListener() {
                            @Override public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                                Utility.haxeOk(callback, "startInputDialog", edit.getText().toString());
                            }
                        }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
                            @Override public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                                Utility.haxeOk(callback, "startInputDialog", "");
                            }
                        })
                        .show();
                edit.post(new Runnable() {

                    @Override
                    public void run() {
                        edit.requestFocus();
                        InputMethodManager inputManager = (InputMethodManager) edit.getContext()
                                .getSystemService(Context.INPUT_METHOD_SERVICE);
                        inputManager.showSoftInput(edit, 0);
                    }
                    
                });
            }
        });
    }

 做法:http://blog.csdn.net/rocks_lee/article/details/8316489

posted @ 2014-01-06 17:35 air_fans 阅读(...) 评论(...) 编辑 收藏