Reputation: 195
I need a starting point to make the following possible.
I have a Main activity start when the Android application starts, as well as an alternate screen that I want to be Debug output (only strings). What I am struggling with is, what layout do I use for the debug screen, and how do I keep this screen constantly populating while I am viewing my Main activity? I do not have any code for this functionality as everything I have tried has crashed my application, so I was hoping to start fresh. I am a super noob to Android so any information would be helpful.
Thanks in advance.
EDIT: I am sorry, I should have been more specific. I will be receiving Debug information over Bluetooth from a robot. Sensor information, location, possibly a camera feed, etc. At the moment I am looking for a good way to display the Debug information that is Text only. I have a Main Activity that will have the controls of the Robot, and I want to have a second separate screen (that can be switched to from the Options menu) that will have the debug information updated in real time. Don't worry about any of the Bluetooth stuff I can already read and write to the socket. Just the "debug screen"
Upvotes: 0
Views: 225
Reputation: 195
After doing some more research I have decided to use a TabActivity instead of trying to do two separate screens. This allows the Tabs to be under 1 Activity and I do not need to worry about inter-Activity communication. Thank you all for you help.
Upvotes: 0
Reputation: 484
I would suggest using the log associated with each method, listener, etc. you'd like to keep track of. See here: http://developer.android.com/reference/android/util/Log.html
The TAG identifies the aspect you'd like to track in your logCat:
private static final String TAG = "MyActivity";
Then you simply add the following into your methods, listeners, etc.
Log.v(TAG, insert variables and other info here);
You use your app on the device or emulator normally and filter your logCat output for the items your tracking. You can do it simultaneously or inspect you logcat after you've used the app for a bit.
Hope that helps...
Upvotes: 1
Reputation: 5759
I would use the eclipse debugger. The console output as well as logcat are also very useful for debugging.
If you must create your own debug screen I would create an asynctask that can run in the background. Each time you get output that should go to your debugger I would send it to your asynctask and have the asynctask store it in the database along with a time stamp. Then any time you want to view debug output pull up your custom view that pulls data from your database. You could use a LinearLayout that has 6 textviews. The textviews could display the last 6 messages from your debugger. How you implement the layout is really up to you. Just make sure you persist the debug info in your database rather than in memory or I can almost guarantee some of your debug info will be lost.
Upvotes: 0