Eric Bradley Carlton Posted May 29, 2012 Share Posted May 29, 2012 Hey guys, I'm completely new to Android programming, but I do have experience with Java programming. I'm trying to learn some of the basics by writing a very basic calorie counter. Here's the code I'm working with: public class CalorieCounterActivity extends Activity { /** Called when the activity is first created. */ private Integer totalCal = 2000; private Integer remainingCal = 2000; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView totalCal = (TextView) findViewById(R.id.totalCal); totalCal.setText("\n\n\nCalories Allowed\n" + totalCal); TextView remainingCal = (TextView) findViewById(R.id.calRemain); remainingCal.setText("\n\n\nCalories Remaining\n" + remainingCal); } } The problem is that when I run the app, the text in the textviews show up correctly, but the variables do not. I get the text: android.widget.TextView@whatAppearsToBeAMemoryAddressHere. What am I doing incorrectly, and how do I fix it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.