[android-developers] Window token is always null

2011-01-17 Thread APF
I find that View.getWindowToken() always returns null, even when invoked from the main Activity during onCreate. For example: TextView tv = new TextView(this); tv.setText(Hello, Android); setContentView(tv); tv.getWindowToken(); // will equal null Manually adding it to the window manager

Re: [android-developers] Window token is always null

2011-01-17 Thread Dianne Hackborn
That's because the view hierarchy hasn't been added to the window manager. You find out it has been added in View.onAttachedToWindow(). On Mon, Jan 17, 2011 at 8:41 AM, APF adriennef...@gmail.com wrote: I find that View.getWindowToken() always returns null, even when invoked from the main