开发者

Mystery! One of my .xml layout resources is just not being detected! What's going on?

UPDATE: Solved, i'm an idiot, thank you everyone!

Okay little bit weird.. I just created a layout file for list items, I can see it there now, in my res/layout folder. It's called itemListBudget.xml. Inside i've declare two id's, catItem and budgetAmount as you can see here: http://pastebin.com/ZV0wr9L0 (it'll only take a second to look at)

So now i'm just trying to bind data from my sqlite table to my list! Here's my method:

//
private static int[] TO = { R.id.catItem, R.id.budgetAmount, };
private void showBudgetOutcome(Cursor cursor) {
    //Set up data binding 
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(
            this, R.layout.itemListBudget, cursor, FROM, TO,);
    setListAdapter(adapter);

}

Now i'm being told that R.id.catItem cannot be resolved. R.id.budgetAmount cannot be resolved and of course R.layout.itemListBudget cannot be resolved. Why on earth could this be?

I also have an error message saying my setListAdapter(adapter) is undefined, but i th开发者_如何学Goink that's caused by the problem above right?


If in Eclipse try to do clean on the project and force it to rebuild R.java

Your layout CAN'T have capital letters in the file name !!! its [a-z0-9_.]


Are you import android.R in your java class? If so, don't, that's the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜