1. HUGE Androidforums.com UPDATE! Learn what's new (and download the new app!)
    Dismiss Notice

Button Arrays

Last Updated:

  1. BlockDude

    BlockDude New Member This Topic's Starter

    Jun 26, 2009
    Likes Received:
    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?


Share This Page