最近始まったばかりの奇妙な問題があります。Eclipse から通常どおりアプリを実行すると、ボタンがメイン画面に表示されません (ただし、本来あるべき場所をクリックすると、イベントが登録されます)。しかし、デバッグモードを使用してアプリを起動すると、ボタンが本来あるべき場所に表示されます! これは、コードの変更なしです。どちらのボタンも、レイアウトで「表示」されるように設定されています。
これがなぜなのか知っている人はいますか?メイン画面から関連するコードを貼り付け、他のすべてをコメントアウトしました...
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 createAndRegisterButtons() {
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
//
}