android

Android add element empty fix

Overview

I had a problem in development for android add element empty list was returned on eclipse when trying to add a new element to PreferenceScreen (XML). The ok button disabled.

android add element empty

android add element empty

Android add element empty

I tried googling with several different keywords but could not find any pratical help online, in any search combination!. beside this and this.which had the same problem as me but sadly both were without any solution.

My solution

I tried several stuff including update my Eclipse/ADT. nothing worked.. My guess is that the problem was with my XML (which I manually edited and formated earlier).  I could try to regenerate a new .XML file (which works fine) but it was important to me to fix that once for all (It happened to me in the past and I just created new XML).

What seemed to fix my problem was changing several eclipse/ADT settings to format my XML again. this time – the way I want it to be!.

Window -> Preferences

What I think to be the fix of the problem are the changes to the eclipse settings, and/or the android settings:

1. In the Preferences window, go to XML -> XML Files -> Editor I checked the ‘split multiple attributes each on a new line’. Just because I like it that way! It’s not required.

android add element empty

 

Let android reformat on save

2. The important stuff was in Android -> Editors settings page. I checked:

  • Format on Save
  • Always remove empty lines between elements (not required – and remember if you checked it)

android add element empty

 

Now, save your XML again (File -> Save or Ctrl+S) (if needed: add any char inside in manual editing mode and delete it) That’s was the solution for me. The file was reformatted and now everything works again!

eclipse_add_fix

That’s it!

 

Development Specialist, Artist and Activist
Personal Website

Leave a Reply

Your email address will not be published.


*