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 Build a Blog Reader Android App Using Intents to Display and Share Posts Easy Sharing with Intents

Last Task in Challenge

Can't get it to work, here's what i have

if (itemId == R.id.action_share) {
    // Add code here!
  Intent intent = new Intent(Intent.ACTION_SEND);
  intent.setType("text/plain");
  intent.putExtra(Intent.EXTRA_TEXT, "hi");
  startActivity(Intent.createChooser(intent, R.string.chooser_title));
}

1 Answer

Ben Junya
Ben Junya
12,365 Points

Almost there!

That last line should be:

startActivity(intent.createChooser(intent, getString(R.string.chooser_title)));

This is because R refers to resources in hex format. You need to call getString() in order to have the data properly set.