0

I'm trying to create my own virtual keyboard since no default keyboard fits my needs. I have created the layout (keyboard.xml), and I'd like to make my keyboard to appear in the bottom of the screen, as other keyboards do. I thought of using popupWindow. I tried pw.showAtLocation(this.findViewById(R.id.mainLinearLayout), Gravity.BOTTOM, 0, 0), where mainLinearLayout is the id of the (root xml element) linearLayout of the currentActivity, but I get a "android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?". Any idea how to solve that ?

Thanks.

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
John156
  • 83
  • 1
  • 1
  • 6
  • Try providing various other contexts. This is only bcoz your popup is not recieveing the required context properly – Andro Selva Aug 19 '11 at 11:49
  • I'm sorry I don't understand your suggestion. Where should I try to provide another context ? – John156 Aug 19 '11 at 11:54

1 Answers1

0

There is a way with an alertDialog. The alertDialog contains your xml. check my answer here :

android editText

And then for positionning your alerDialog see this thread :

Show AlertDialog in any position of the screen

Community
  • 1
  • 1
mthpvg
  • 3,789
  • 3
  • 26
  • 34