我试图在Activity类中设置一个断点:
public class MainActivity extends Activity {
private EditText htmlContent = null;
private Button getBtn = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); // <<<< this is where I set a breakpoint
htmlContent = (EditText)findViewById(R.id.htmlContent);
getBtn = (Button)findViewById(R.id.get);
// anonymous inner class implementing OnClickListener
getBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
// fill htmlContent using HTTP GET
try {
final TestHttpGet thgObj = new TestHttpGet();
thgObj.executeHttpGet();
}
catch (Exception e){
// do something meaningful here
}
}});
// start some activity here?
getBtn.setEnabled(true);
}
}
Run Code Online (Sandbox Code Playgroud)
现在,有趣的是这个程序运行,我甚至可以在模拟器中看到它的布局屏幕,但是当我点击getBtn时没有任何反应,所以我试着在里面设置一个断点来查看原因.
令人惊奇的是......没有达到断点 - 即使我在OnCreate()的第一个语句中设置它.这怎么可能???