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

Button Arrays

Discussion in 'Application Development' started by BlockDude, Jun 26, 2009.

  1. BlockDude

    BlockDude New Member
    Thread Starter
    5

    Jun 26, 2009
    1
    0
    5
    Hello everyone, I'm in the middle of developing a calculator app to familiarize myself with the SDK, and came across a bit of a problem. I remember in other frameworks, I could create button arrays, however I can't find a way with the Android SDK.

    Basically, I'm laying out the GUI in an XML file, and I want each number on the calculator to be an array, so that I can handle the values with just one onClick event function.

    So I want to have the main "button_numpad" button, but then for every number it would be "button_numpad[1]", "button_numpad[2]", etc. And when clicked, the function would have the number as a variable.

    Is this possible? If not, is there another way of doing this, or will I have to make a function for every numpad number?
     

    Advertisement

Share This Page

Loading...