Android Application Development Tutorial – 48 – Recieving Bread String from Activity

Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –






47 responses to “Android Application Development Tutorial – 48 – Recieving Bread String from Activity”

  1. Prakhar Dev Gupta Avatar

    My app crashes as soon as it opens for Data . Why??
    Here is the JAVA code:


    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;
    import android.widget.Toast;

    public class Data extends Activity implements OnClickListener{

    Button start,startFor;
    EditText sendET;
    TextView gotAns;
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub

    private void initialise() {
    // TODO Auto-generated method stub
    start = (Button)findViewById(;
    startFor= (Button)findViewById(;


    public void onClick(View v) {
    // TODO Auto-generated method stub

    switch (v.getId()) {

    String bread = sendET.getText().toString();
    Bundle basket = new Bundle(); //Bundle is like a basket that holds the data
    basket.putString("key", bread); //Key is actually the reference to the string which is like file name we refer to
    Intent a = new Intent(Data.this,OpenClass.class);


    Toast.makeText(getApplicationContext(), "Not applicable!", Toast.LENGTH_SHORT).show();


  2. Sara EL MALKI Avatar

    Thanks Travis ! You've well explained the realation between the Intent, Extras and Bundle !

  3. Benjamin Lunkim Avatar

    I typed Jessica Alba… and the app stopped working. Yes I added the line 'selectionList = (RadioGroup) findViewById(;' but it still crash. I'm out of option. there are no errors that I could see. Help.

  4. jlikansis Avatar

    Why could I not pass the data like this (in
    instead of creating Bundle, Intent, etc?

  5. Murad Sheshani Avatar

    Travis big big thank you 🙂

  6. M Maas Avatar

    The sample project is really helpful if your stuck.

  7. Roshan Lakmal Avatar

    Those Who have errors
    1.You must put both Class in the Manifest 
    2.The initialization in both class .Carefully double check the ids are matched.

  8. CaptainBoomerang Avatar

    Well when i click on Start Activity button the openedclass opens and everything is fine except the text is not there!
    What have i done wrong?

  9. Divine Jakiro Avatar

    Anyone know what if i want send multiple string and also a multiple integer? only 1 bundle could do that?

  10. UtopianLove Avatar

    Jessica Alba XD 

  11. asssafj Avatar

    Thank you! your tutorial is the only one that helped me.

  12. Adam Ben Shabat Avatar

    My error was in the OpenedClass class, I had setContentView(R.layout.get) instead of setContentView(R.layout.send). Make sure you don't confuse them because your app will keep crashing!

  13. Burawi Ben Ammar Avatar

    did you define the class (data and openedclass) in your manifest ?

  14. Ada Digital Art Avatar

    "Unfortunately Data has Stopped" anyone has the same problem?

  15. Yusuf Ali Bozkır Avatar

    Intent OpenedClass = new Intent("android.intent.action.OPENEDCLASS");

    Why you define intent like below instead of this?

    Intent OpenedClass = new Intent(Data.this, OpenedClass.class)

  16. Mario Noriega Avatar

    Your suggestion fixed my problem, thank you all the way from El Paso Texas.

  17. simran kaur Avatar

    Hey guys, I followed the tutorial step by step, yet it starts when i click on data from the menu, but when i click on teh button start or startforresult,Its not working.I just keep on clicking and nothing happens.Can anyone explain hat might be the reason

  18. Jake Harlinski Avatar

    tried String gotBreadForTheMostPart;

    Did not work

  19. Jake Harlinski Avatar

    'I'm like, Hey , can I have that key? And if you hand me a piece of bread, you know what i'm talkin about".

  20. Jun Ke Avatar

    I crashed the app because I initialize selectionList after selectionList.setOnCheckedChangeListner

  21. KaptenFluffen Avatar

    Here's my data class. Currently at video 67 but I pasted it here pastebinDOTcom/uCCEgd7f

  22. Mustafa Küçükşengün Avatar

    Same here. Can some1 help?

  23. vsorinable Avatar

    "so, whenever I need bread…"

  24. Francisco Nuñez Hernandez Avatar

    So Fucking Awsome! YOU ARE POWERFUL!

  25. KaptenFluffen Avatar

    Will try it out, thanks alot!

  26. Mircea Trifan Avatar

    maybe because you have written your code for start activity in the start activity for result field.

  27. Mircea Trifan Avatar

    be sure that the setOnCheckedChangeListener is of RadioGroup type and not CompoundSomething (i'm not sure what it is)

  28. KaptenFluffen Avatar

    selectionList.setOnCheckedChangeListener(this); is all red for me, dont get what's wrong, i've basicly copied what travis had in his code.

  29. IronrockVidz Avatar

    my application crashed and I noticed that I was missing this part "setContentView(R.layout.send);" from the, you can see it in the video at 6:01.

  30. Omair Vaiyani Avatar

    If fixing the manifest doesn't fix the 'Start Activity' button causing the crash, make sure you've found the view id for the return button, I suspect that might have caught a lot of you out since Travis forgot to mention it before.. in the initialize() method in, do the return button findViewById

  31. Sartheris Stormhammer Avatar

    In this tutorial we are going to eat some bread from the most part! YAY!

  32. gregslife7 Avatar

    If your app crashes, it helps to read the error message in the "LogCat" section. It'll be a long red block of text, but the important section is in the second line; it'll say something like "android.content…(this part doesn't matter)…exception: Unable to find activity class; have you declared this activity in your AndroidManifest?." This makes it easy to diagnose crashes on your own.

  33. Chad Bingham Avatar

    1 Did you define all your classes in your manifest?
    2 And double check that your code is in the right classses. This one is easy to mix them up.
    3 AND check your intent. That's where my issue was. In the intent I had the wrong class.

  34. Andreas Leventakis Avatar

    I have the same problem!!

  35. Rakeeb Rafee Avatar

    my TextView "tvQuestion" is showing the send.xml layout, but when i run the program it is not appearing… any idea wats wrong??

  36. Max Grossenbacher Avatar

    In the file my tvText id [test = (TextView) findViewById(;] it asks me if I want to Create field 'tvText' in type 'id', which I did, but when I save it will automatically remove the tvText line again. Any ideas?

  37. harristung Avatar

    For those who crashed on Menu Data tab click, I had the same problem! Check your initalize() vars.. gotAnswer = (TextView) …

  38. chinesecheeunit Avatar

    Is there any significance of creating that Intent the way he did in this tut.?
    Previously we have used:
    Intent i = new Intent("com.newboston..travis.OPENEDCLASS");
    but instead we passed in 'this' and a type class and… Yeah… Anyone care to elaborate?

  39. Tobias Konradsson Avatar

    Did you write the new code in the right class? I wrote it in :p, it was supposed to go in!

  40. tutlage Avatar

    I have defined everything inside the manifest , no errors but still it crashes every time i click on data inside my emulator . Any Idea

  41. Chad Bingham Avatar

    I am FC when i click on startActivity. I declared both classes in my manifest…. what else could i be doing wrong?

  42. Chris Peng Avatar

    If you are getting a crash from clicking Data Button try switching the order of initialize() and setContentView(R.layout.get)
    IE: put initialize() AFTER setContentView(…)

  43. Akshay Khanna Avatar

    Anybody can tell why had't we used action name of OpenedClass while defining intent variable in data class ?
    Intent a=new Intent(Data.this,OpenClass.class); Instead Of:
    Intent a=new Intent(Data.this,com.NewBoston.Travis.OPENEDCLASS);

  44. Akshay Khanna Avatar

    Travis i asked u about radiogroup think in previous tutorial but now i get the answer …:p

  45. Madeinchinaagain Avatar

    does the manifest file require an intent filter? if so, how to set up?

Leave a Reply

Your email address will not be published. Required fields are marked *