Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android The Problem

Semen Zadorozhnyi
Semen Zadorozhnyi
8,515 Points

Nice one!

Great task for self-learning Ben Deitch , but pretty easy. Let's do more of this and more complex 8)

1 Answer

Ezekiel dela Peña
Ezekiel dela Peña
6,231 Points

This is awesome I did it but I made my code more complex than it should be.

Was overthinking a bit too much.

mAddOneBtn.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                  // Get string which should be number then convert it to a int data type
                  String currInt = (String) mCurrCountTextView.getText();
                  int currCount = Integer.parseInt(currInt);

                  // Add and display the value
                  mCurrCountTextView.setText(Integer.toString(addOne.plusOne(currCount)));
            }
        });

Thanks for this exercise.