Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphical Layout shows null Pointer exception

I have a UI design for an application. As we know that there are two view while designing a UI for an app in android in eclipse one the xml view and other the graphical layout. i am having a problem that i cannot get graphical layout of my xml. it shows a null pointer exception when i switch to graphical layout. Any suggestions..?

like image 764
Usama Sarwar Avatar asked May 25 '26 08:05

Usama Sarwar


1 Answers

I think you might find that the View.isInEditMode() function is what you are looking for.
Use it on any view that you have a reference to in the Activity.
If it returns true, don't attempt to get the reference that you were trying to get.
It's a little hard to tell if this will fix it for you, but you should definitely try this.

like image 154
Caspar Harmer Avatar answered May 27 '26 22:05

Caspar Harmer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!