开发者

Buttons show up on Debug but not on regular run of application on Eclipse for Android

I have a weird problem that only started recently. When I run the app normally from eclipse, my buttons don't show up on the main screen (however if I click where they are supposed to be, it registers the event). But when I start the app using the debug mode, the buttons show up right where they are supposed to be! This is with no changes in code. Both buttons are also set to be "visible" in the layout.

Anyone know why this is? I pasted the relevant code from my main screen, I commented everything else out...

package com.android.market.companionpushup;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainScreen extends Activity {
public static String mWorkout;


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainscreen);

    // Create database helper
//  mDbHelper = new WorkoutDbAdapter(this);

    createAndRegisterButtons();
}

private void createAndRegisterB开发者_运维问答uttons() {
    Button GoButton = (Button)findViewById(R.id.start);
    Button TestButton = (Button)findViewById(R.id.test);

    GoButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
 //             int workout = chooseWorkout();
 //             startWorkout(workout);
        } // end onClick
    }); // end of GoButton


    TestButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
 //             startWorkout(100);
        } // end onClick        
    }); // end of TetsButton

} // end of createAndRegisterButtons
 // 

 }


Ended up restarting the computer and phone and it worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜