Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Adding an item to a list from a fragment.

Hello.

I was wondering if it was possible to add an item to a list, in an activity, from a fragment. For example: let's say I'm filling out a line of text in a fragment, then I press a button that takes me to the main activity, in that activity there is a list and I want the line of text I wrote to appear there. I'm having trouble figuring out how to do it, should I use an intent perhaps?

Thanks!

1 Answer

But what if my list view is not in a fragment and my fragment is in a different activity?