• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

intent.putExtra() question

 
Ranch Hand
Posts: 62
2
Mac Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been reading through This tutorial on www.developer.android.com.  All I need to do is copy the code but I'm having a problem with the code below.   I have no idea what the EXTRA_MESSAGE is for.  Its giving a an error anyway so I'm guessing I must change it to something else?  I was reading something about my package name goes there but that also doesn't work.  Thanks.

 
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You only need putExtra if you want to pass additional data to the new activity. If not, you can omit it.
 
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The EXTRA_MESSAGE is the string you need to bring to next activity.

You can write like this



To get the string message in DisplayMessageActivity, you have to write in this way


 
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OP consider that in real life scenario( but even simple tutorials) you could like to use as well onActivityResult   onActivityResult
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you declared EXTRA_MESSAGE ? It has to be a variable of type string, or you should include it inside of quotes "EXTRA_MESSAGE" , then you will not get the compilation error
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic