Back to project page TheNewBoston.
The source code is released under:
Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECI...
If you think the Android project TheNewBoston listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.homelysoft.thenewboston; /* ww w .ja va 2 s. co m*/ import com.homelysoft.thenewboston.R; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class StartingPoint extends Activity { int counter; Button add, sub; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.starting_point); counter = 0; add = (Button) findViewById(R.id.addB); sub = (Button) findViewById(R.id.subB); display = (TextView) findViewById(R.id.counter_display); updateDisplay(0); add.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { updateDisplay(++counter); } }); sub.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { updateDisplay(--counter); } }); } public void updateDisplay(int newCounter) { display.setText(getResources().getString(R.string.total_display)+" "+newCounter); } }