[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
I've used ListViews before but what's really different in this case is the fact that my ArrayAdapter is being built in an AsyncTask. When I call the constructor for the ArrayAdapter, I'm using the context MyActivity.this, which is the context of the parent of the AsyncTask. I wonder if this is

[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
OK, I moved the code that builds the ArrayAdapter from the AsyncTask into the main thread and it works. So it's definitely related to not being able to find the resource when the adapter is built in an AsyncTask. Strangely, the error doesn't happen during the execution of the async task. It

[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
I tried passing the resource ID to the AsyncTask, rather than using R.id.chooseTableRowTextView from within the async thread and that did not solve the problem. So it appears that the real issue is finding the right context for ArrayAdapter's constructor. Perhaps the only way to make this work is

[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
Calling the ArrayAdapter constructor from the main thread worked. Looks like I found a bug in the the ArrayAdapter. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To

[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
I turns out that I misinterpreted my results. The Resource Not Found error persists, even if the ArrayAdapter is created in the main thread and then filled in the Async Thread. Anyone have any ideas for other things to try? -- You received this message because you are subscribed to the Google

Re: [android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Kostya Vasilyev
I'd try it like this: Initialize the ListView and its adapter in the main thread, then start the async task. The task would post new items to a callback in the main thread (possibly using publishProgress / onProgressUpdate). The callback would add new items to the underlying data structure

[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
That's not far from what I'm doing already. I'm creating the ListView and ArrayAdapter and calling setListAdapter in the main thread. Then I fill a separate ArrayList in the AsyncTask.doInBackground. Then, in AsyncTask.onPostExecute which runs in the main thread, I fill the ArrayAdapter from the

Re: [android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Mark Murphy
On Tue, Sep 7, 2010 at 3:13 PM, Bret Foreman bret.fore...@gmail.com wrote: That's not far from what I'm doing already. I'm creating the ListView and ArrayAdapter and calling setListAdapter in the main thread. Then I fill a separate ArrayList in the AsyncTask.doInBackground. Then, in

[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
Here's the code where I set the resource: tableListAdapter = new ArrayAdapterString(this,R.id.chooseTableRowTextView); setListAdapter( tableListAdapter ); Note that R.id.chooseTableRowTextView = 0x7f070004 and is a TextView. Here's the full stacktrace from

Re: [android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Mark Murphy
On Tue, Sep 7, 2010 at 4:57 PM, Bret Foreman bret.fore...@gmail.com wrote: Here's the code where I set the resource:                tableListAdapter = new ArrayAdapterString(this,R.id.chooseTableRowTextView);                setListAdapter( tableListAdapter ); Note that

[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
I tried changing it to the name of the layout and got an exception saying java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView. The layout file I pointed to is this: ?xml version=1.0 encoding=utf-8? LinearLayout android:id=@+id/chooseTabelRowLinearLayout

Re: [android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Mark Murphy
On Tue, Sep 7, 2010 at 6:08 PM, Bret Foreman bret.fore...@gmail.com wrote: I tried changing it to the name of the layout and got an exception saying java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView. You are using the ArrayAdapter(Context context, int

[android-developers] Re: Trying to diagnose a Resource Not Found exception

2010-09-07 Thread Bret Foreman
The first choice proved problematic because the Resource parser didn't like a file in the layout folder that didn't have a layout in it. The second choice is working great. Thanks! Now, you have two choices: 1. Get rid of the LinearLayout from your row XML, since it is doing you no good, and