tags:

views:

22

answers:

1

I am working off the Android Notepad Tutorial as a base. The problem is that when someone creates a record with a null name field, it shows up as a blank space in the listview and is unclickable, and therefore undeletable from the list.

I would like to have the program check for a null "name" field and replace it with the string "Unnamed Record" so that it comes up appropriately in the listview. Everything that I have tried so far has not worked correctly.

Another possible solution might be the give the name field an initial value of "Unnamed Record" but I am not sure that this would be effective.

Thanks.

A: 

I'm unsure how you're doing this. could we see some code? If its an edittext that you're using to retrieve the text just check if what is returned is equal to null? If there's no way of checking the input directly one such solution would be to check the field itself when you're extracting it from the database.

E.g: when you're using a cursor to extract the value in field name just check if it's equal to null?

It's kind of hard to come up with a more specific answer without seeing some code.

Aidanc
Should I be looking at the DBadapter or the populatedata() method in the NoteEdit activity? Where in the code would it make the most sense to add this null check? I will add some relevant code snippets to my initial post.
Frank Bozzo