As it turns out, I'm emptying that array after I send it off.  For
some reason the broadcast receiver is either using a reference to it,
so it gets the cleared one, or is sending after it's cleared.  Either
way, not clearing the array after allows it to show up correctly.

On Mar 2, 2:13 pm, tatebn <[email protected]> wrote:
> What's confusing to me is that it actually gets an ArrayList<String>.
> It's just been emptied out somehow.
>
> On Mar 2, 1:25 pm, tatebn <[email protected]> wrote:
>
>
>
>
>
>
>
> > Accidentally left that prefix in the code there.  That's not the issue
> > in the actual app.
>
> > On Mar 2, 1:17 pm, tatebn <[email protected]> wrote:
>
> > > It's the intent in the broadcast receiver's onReceive message
>
> > > /** Handler for content ids updated. */
> > > private BroadcastReceiver mContentIdsUpdated = new BroadcastReceiver()
> > > {
> > >      @Override
> > >      public void onReceive(Context context, Intent intent) {
> > >          Log.i(TAG, "received " +
> > > intent.getStringArrayListExtra(Common.CDCUpdatedContentIdsKey).size()
> > > + " items in receiver"); // 0
> > >          Log.i(TAG, "content ids updated in activity " +
> > > intent.getStringArrayListExtra(Common.CDCUpdatedContentIdsKey));  //
> > > empty array
> > >      }
>
> > > };
>
> > > // In oncreate
>
> > > LocalBroadcastManager.getInstance(this).registerReceiver(mContentIdsUpdated
> > >  ,
> > >                             new 
> > > IntentFilter(Common.ContentIdsUpdatedNotification));
>
> > > On Mar 2, 12:15 pm, Mark Murphy <[email protected]> wrote:
>
> > > > Are you sure you are looking at the right Intent?
>
> > > > On Fri, Mar 2, 2012 at 11:25 AM, tatebn <[email protected]> wrote:
>
> > > > > I'm using LocalBroadcastManager to send data between classes. I'm
> > > > > trying to send an ArrayList of String objects, 1 dimensional, in one
> > > > > of them. The array has all my strings when I send it, but on the
> > > > > receiving end it is empty. Has anyone seen this before? Here's my
> > > > > code.
>
> > > > > Send Message (I can print the array here and it has 5 items):
>
> > > > > Intent updatedIdsIntent = new
> > > > > Intent(Common.ContentIdsUpdatedNotification);
>
> > > > > updatedIdsIntent.putStringArrayListExtra(Common.UpdatedContentIdsKey,
> > > > > this.updatedContentIds);
>
> > > > > LocalBroadcastManager.getInstance(ctx).sendBroadcast(updatedIdsIntent);
>
> > > > > Retrieve Message (always empty):
>
> > > > > Log.i(TAG, "content ids updated in activity " +
> > > > > intent.getStringArrayListExtra(Common.UpdatedContentIdsKey));
>
> > > > > Why are the items gone from the array in the broadcast receiver?
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Developers" group.
> > > > > To post to this group, send email to 
> > > > > [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > --
> > > > Mark Murphy (a Commons 
> > > > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > > > Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to