Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Antonis Tsagaris
17,511 PointsIntent.createChooser() returns an error
I cannot complete the Code Challenge because the compiler gives me an error at the dot between "Intent" and "createChooser". I'm pretty sure that I'm doing everything right. Any ideas?
3 Answers

Javier Briones
Front End Web Development Techdegree Student 29,674 PointsI figured it out. Here's my working code:
startActivity(Intent.createChooser(shareIntent, getString(R.string.choose_title));
You have to use the 'getString' method to get the string from 'R.string.choose_title'

Hiroki Hokari
5,308 PointsCould you post the code including the error part?

Antonis Tsagaris
17,511 PointsIntent inte = new Intent(Intent.ACTION_SEND); inte.setType("text/plain"); inte.putExtra(Intent.EXTRA_TEXT, "extra text"); startActivity(Intent.createChooser(inte, R.string.chooser_title));
Fixed though - Xavier found the solution.

Javier Briones
Front End Web Development Techdegree Student 29,674 PointsI'm having the same problem too
Antonis Tsagaris
17,511 PointsAntonis Tsagaris
17,511 PointsThanks. Weirdly, during the tutorial the code seemed to work fine without the getString() method.