Reputation: 1
I am trying to make a simple counter to test out what I've learned so far in Android. The xml seems to be right as it shows up just fine on the preview window but I think there is something off with the java as I can not get it on my phone, it is simply blank.
Here is the xml http://pastebin.com/G6Y4RFMb
Here is the Java http://pastebin.com/mNmT3bUJ
Thank you for your time. This is my first time posting so if I did anything wrong please let me know.
Upvotes: 0
Views: 347
Reputation: 1321
You have to add this to the activity!
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.name_of_the_layout_file);
}
Maybe you just missed if not, this method is called by the system and is the right place to set up things. One of these things is the aspect of your activity.
P.S.: this is not Javascript, just Java.
Upvotes: 0
Reputation: 3149
It is blank because you have not called your xml to work. Use something like this:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myxml);
}
Upvotes: 1