1. Download our Official Android App: Forums for Android!

Apps SOLVED: App help

Discussion in 'Android Development' started by brggames, Sep 12, 2011.

  1. brggames

    brggames Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    12
    Joined:
    Sep 12, 2011

    Sep 12, 2011
    12
    0
    35
    Howdy. Just getting into android programming and have ran into a snag. My program opens with a splash screen then goes to a menu screen with 3 buttons. The 2 buttons I've coded so far work, but the target class of one crashes. I know the buttons work because I had it go to a temp class I made and it went there fine.

    Also, when I only have the basic code in the target class it works.

    That works, but the next one does not work. It crashes.

    and here is the xml file

    Any help would be appreciated.
     

    Advertisement

  2. mills2533

    mills2533 Well-Known Member
    Rank:
    None
    Points:
    38
    Posts:
    150
    Joined:
    Dec 21, 2010

    Dec 21, 2010
    150
    22
    38
    Colorado (USA)
    Remove "Button" from in front of each of the lines like this:
    Button bLeft1 = (Button) findViewById(R.id.bLeft1);

    Make it this instead:
    bLeft1 = (Button) findViewById(R.id.bLeft1);

    Because you've already declared the buttons here:
    Button bForward1, bBack1, bLeft1, bRight1, Bpause1, bPlayMusic1;
     
  3. brggames

    brggames Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    12
    Joined:
    Sep 12, 2011

    Sep 12, 2011
    12
    0
    35
    Still crashes, here is the modified code

     
  4. brggames

    brggames Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    12
    Joined:
    Sep 12, 2011

    Sep 12, 2011
    12
    0
    35
    I comment out the thread, switch/catch code using /* */ and it still crashes
     
  5. brggames

    brggames Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    12
    Joined:
    Sep 12, 2011

    Sep 12, 2011
    12
    0
    35
    I comment out everything and it works. I doubled and tripled checked my AndroidManifest.xml, and for the life of my I can't figure it out. As I said, I'm new and may be missing something very simple. Here is the code with the stuff commented out. the menu code at the bottom works perfectly (the restar button isn't coded yet).

     
  6. brggames

    brggames Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    12
    Joined:
    Sep 12, 2011

    Sep 12, 2011
    12
    0
    35
    here is the start activity code in the previous class

    and the activity code in the AndroidManifest.xml

     
  7. brggames

    brggames Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    12
    Joined:
    Sep 12, 2011

    Sep 12, 2011
    12
    0
    35
    I knew it was something simple I was missing, bPlayMusic1 was an ImageButton, not a Button lol.
     

Share This Page

Loading...