0

Sometimes the program runs into an infinite loop, or the LogCat contents are too lengthy for the Logcat to display them all. In that case, we need to terminate execution in the middle of it. How can we do that?

I can't no more see the red square I once used to see in the console window when coding Java.

It's not about debugging because what would a breakpoint do in the case of an infinite loop?

enter image description here

  1. Another question is that my logcat won't dock to the right side of the window in eclipse. Instead when I try to drag the Logcat window to the right side (where the "outline" window and "restore" button is present- I want to dock is beside them), the mouse pointer starts showing this sign: How do I dock the Logcat button on the right side (It is docked to the left in the above picture) ?

enter image description here


enter image description here

Solace
  • 8,612
  • 22
  • 95
  • 183
  • 1
    'halting problem'? Don't let the programs run into an infinite loop. Maybe its my browser but I can't see the picture? – j4rey Nov 29 '14 at 11:50
  • "Halting" is the right term, but the solution you suggest is lame, who wants to run them into an infinite loop?! – Solace Nov 29 '14 at 11:51
  • 1
    Haha, I know, but that's the only solution. There is no way to logically break from an infinite loop[read on halting problem]....perhaps you can post some of the code and where it going into the infinite loop – j4rey Nov 29 '14 at 12:00
  • Its not about code, it is about eclipse. There used to be a button in red color in eclipse console window for java which was used to halt the execution. – Solace Nov 29 '14 at 12:38
  • 1
    For Java Programs ? Yes, to terminate the program. For Android Programs it won't be there in Console window but on the tools bar on top of the screen. Same red button – j4rey Nov 29 '14 at 12:46
  • Where is it? I can't see it? Can you locate it in the screenshot I just posted? – Solace Nov 29 '14 at 12:53
  • 1
    Possible duplicate http://stackoverflow.com/questions/4972699/android-how-to-stop-running-program-under-eclipse For the second question you should open a new thread. BTW in Android Studio iirc it's possible, don't know why they didn't add this to ADT. – User Nov 29 '14 at 12:58

2 Answers2

1

Weird thing is I can't see your screenshot. something wrong with my browser or something else. I have added my screenshot, you'll see a red button on the tool bar. Go to Window->Show Toolbar if your toolbar is not visible. Here's my screenshot

Changed my comp, and now I am able to see your screenshot. As for your Want-Logcat-to-Right problem, Try Window->Reset Perspective it should give you the same layout as my screenshot above and when you minimize it, it would hide to the right of the window like the screenshot below enter image description here

j4rey
  • 2,582
  • 20
  • 34
  • I just solved 2 accidentally. I displayed the LogCat window on the right side of main console where we write the code (dunno what it's called) and then I had to maximize the window where I was writing code, which docked the Logcat Window to the right side of the Eclipse Window beside "Outline". Thank you for answering. I am not going to touch it to try your solution in fear that I might disturb it again. – Solace Nov 30 '14 at 07:31
1

1. To stop app in the middle of execution:
- go to Devices window or open it:
- - from Debug perspective: Window -> Show View -> Devices
- - from other perspectives: Window -> Show View -> Other... -> type "Devices" or just find
- select process you want to stop (it should be launched from the same instance of Eclipse)
- press stop button on the toolbar

Note. "Red button" isn't visible when Eclipse doesn't know what to stop. It happens when you simply start your app (not for debugging) or debug several apps at the same time (in this case you should explicitly choose process in the Debug window to activate "red button").

2. There is usually no problem to dock logcat to any side of the hosting window - just drag it to the middle of required window side.

Update
Sometimes Eclipse UI behaves strange as a result of accumulation of minor configuration changes (including during updating etc). You may try to move <YourWorkspace>\.metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi file to some backup location and start Eclipse.
It may require to reconfigure some of your settings. If you are not satisfied just move original workbench.xmi back.

sberezin
  • 3,266
  • 23
  • 28
  • Please see update for (2). Has my answer for (1) helped you or you mentioned something else? – sberezin Nov 29 '14 at 18:06
  • I just solved 2 accidentally. I displayed the LogCat window on the right side of main console where we write the code (dunno what it's called) and then I had to maximize the window where I was writing code, which docked the Logcat Window to the right side of the Eclipse Window beside "Outline". Anyways thank you very much for answering. (1) did answer my question. I was trying to find the red button in the Logcat window or on the title bar of the "Java" perspective. Your answer clarified that it is in the "Debug" perspective only. – Solace Nov 30 '14 at 07:27