I trying to debug code on my first Android program. I started using the regular println and it worked in the earlier main(onCreate) method, showing the results in LogCat. However, it doesn’t seem to work below, so then I started trying to work out Log.i/Log.d to no sucess. I’m basically trying to see if the program actually runs the below method – although no print statements are produced in the LogCat, I think the code is actually running as when I hit the “new” or “exit”button on my app, it seems to fo to the correct place in the case statement and runs finish();
Any help with would be really appreciated in getting something printed to LogCat, so I can see what’s going on.
Thank you
Ed Ryan
public void onClick(final View v) {
System.out.println("Here in - onClick");
switch (v.getId()) {
case R.id.about_button:
System.out.println("Here in - onClick1");
Intent i = new Intent(this, About.class);
startActivity(i);
break;
case R.id.new_button:
System.out.println("Here in - onClick2");
finish();
//openNewGameDialog();
break;
case R.id.exit_button:
Log.i("onDisabled","info");
Log.d(TAG, "onDisabled");
System.out.println("Here in - onClick3");
finish();
break;
}
}
}//end class
I’ve experienced this while using LogCat within Eclipse.
This happens when the device drops off or loses focus or when you’re debugging using 2 or more different devices/emulators.
Try the following: