Reply to comment

TPCalc for Android

A while back, I made a little program called TPCalc to do one of my favorite mundane activities, which is to determine the best price for toilet paper at the discount store, using a toy program written in a bunch of different languages. Given that you typically don't flip open your notebook computer at the store, the program really didn't make sense (in any computer language). No longer. Here is the Android version of TPCalc.

No longer do you need to remember that you can simply divide the price by the # of rolls, then divide again by the number of sheets per roll. You can rely on the computer application to remember that for you.

The only interesting thing in the program is that, instead of forcing a recalculation of the total when the "Calculate" button is pressed, it simply moves the focus to the button. That causes the field to defocus, which triggers a recalculation.

        button1 = (Button)findViewById(;
        button1.setOnClickListener(new OnClickListener() {
        	public void onClick(View v) {
        		// on a click, just blur what was being typed

Sources are in the zip file. The installer is the apk file. is the hand-written part of the project.

PS - This is my first non-tutorial Android app.

TPCalc.zip106.26 KB
TPCalc.apk230.89 KB
tpcalc.jpg8.1 KB
MainActivity.java2.99 KB


The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.

More information about formatting options

17 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.