1. Check out our companion app, Forums for Android! Download from Google Play

Button onClick setText causes Crash ?

Discussion in 'Application Development' started by VaMoose, Dec 9, 2012.

  1. VaMoose

    VaMoose Member
    Thread Starter
    5

    Dec 7, 2012
    5
    0
    5
    Male
    Web and Graphics Designer
    Bryanston, Gauteng, South Africa
    Hi there. I am trying to set the Text of a Text View when a button is clicked.

    I have been struggling, because the variable will increment, but If i put the code in to set the text, it crashes the app ?

    Here is my code when it crashes:

    however if I comment out the line
    , the app doesnt crash, but it doesnt do anything then.

    Please can someone help me!
     

    Advertisement

  2. myrecek

    myrecek Active Member
    16

    May 10, 2012
    29
    2
    16
    Hi

    you are calling setText(int) wich expects resId as argument which is probably not what you are looking for. You should use something like:
    [HIGH]score.setText(String.valueOf(points));[/HIGH]
     

Share This Page

Loading...