I've been hacking away at me check list that allows me to add strings via dialog box. The strings are then added to an ArrayList<Item> which I have a separate class that defines that object. As far as I can tell I have the syntax correct but it tells me "The constructor ClickData.Item(String, boolean) is undefined"
The problem is in the addItem() method "aiItems.add(new Item(sItem, true));" Any thoughts as to how I can get this to work so that I can add it to the ArrayList<Item>? Thanks in advance.
Does the message mention "ClickData.Item" or "ClipData.Item"? You imported the latter, so perhaps you retyped the error message with errors instead of just copying and pasting it?
In any case the Item class whose code you posted isn't either of those. If you want to use the Item class that you posted, then you shouldn't be importing a different Item class (i.e. android.content.ClipData.Item). In fact since the Item class that you posted is in the same package as your ListActivityDemo class, you shouldn't have to import any Item class at all.
Joined: Apr 26, 2012
It says ClipData.Item(String, boolean), pasted below is the error I copied. Yeah its weird will try retyping the method to see if that does anything.
"The constructor ClipData.Item(String, boolean) is undefined"
Tom Mordon wrote:The thing is I have no idea what ClipData.Item is, I'm just trying to use Item.java since it defines the Item object I created. So yes I'm trying to use the Item.java which defines my Item object.
Then importing ClipData.Item wasn't the right thing to do. I expect you did that at an earlier stage when your IDE told you it couldn't find an Item class and gave you a list of things which might be suitable, and you chose one at random from the list. Or something like that. Anyway you don't want to use ClipData.Item so don't import it.
Joined: Apr 26, 2012
Thank you, that makes sense now. Need to pay attention to imports.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Not letting me create and add user defined object to ArrayList