Handling android application in Eclipse

317 Views Asked by At

Recently I started to learn Android Development. Since the emulator is slow and buggy on my PC, I'm trying to install app directly to my device HTC Desire S.

My questions:

1: How can I stop the application properly? ( I know that I can do it via Devices View in Eclipse, but very often the app just start again. )

2: How can I log only one application in LogCat? ( The process com.fd.httpd->HTCSense is generating a TONS of output. Yes I can make a new filter, but the number of logs from HTCSense is always growing and after approximately 10 000 logs, which is matter of 20 seconds, my logs are deleted because of full buffer. )

3: How should I properly stop the connection between my device and Eclipse? Pulling cable out of device "on the fly" is not the best solution I think. ( For example when I run J2ME project with Ant, in Console view there is "Terminate" button. )

Thank you for your answers/recommendations!

3

There are 3 best solutions below

0
On
  1. Normally I dont stop the app. I just hit either the home button or the back button until I reach the home screen. The app's activity will be onPause state. In android app's aren't really closed. They are only closed when the phone is low on memory. Like you said, you can kill the process.

  2. AFAIK filter is the way to restrict the view of logs. In ADT 14, now application name is also shown along with the log. I always keep a filter on so it will only show my logs.

  3. I use windows, So in that I click the safely remove USB device and thats it. Sometimes this does screw up eclipse and I stop receiving logs. So I just kill the adb server and start it again.

This is how I normally do things.

1
On

1 - what he said above. Android doesn't work like Windows, you cannot 'end' an Application/Activity (apart from Force-Closing it) because you do not need to!

2 - Using Eclipse log filters and ensure you use a tag in your Log messages to separate them out e.g. Log.d("MYAPP","stuff...") Note: The latest SDK update (14) has made this even snazzier and easier to use

3 - I never bother, I just pull the cable when I want my phone back - probably 30 times a day and I've yet to see an issue. Note: ADB will sometimes freeze - if you're having trouble connecting, Alt-Ctrl-Delete into Task Manager and kill it (it normally restarts automatically - if not you can start it from DDMS)

0
On

As all the other answers said,the log is what it is: you need a filter.

In the Debug perspective, you can right click on the process and select "Terminate" to end it.

Unplugging the USB cable is fine: the phone won't care. Eclipse does periodically lose its mind, but you can just restart.