Get rid of date PID and Package name in Logcat [duplicate] - android

Is there any way that I can view my print statements in android studio without displaying the time and directory? It's extremely distracting and hard to debug when that text is taking up so much space.

In the Android Monitor view in Android Studio (tested on Version 1.3), in the vertical toolbar inside the "logcat" tab, you will find a gear-shaped toolbar button. Click that, and you will get a "Configure LogCat Header" dialog with checkboxes to allow you to toggle on and off various pieces of what gets displayed:
Uncheck the items that you do not want (e.g., "Show time"). Note that LogCat does not show any "directory" except with respect to something you log yourself. My guess is that by "directory" you are referring to the package name.
This does not appear to affect existing messages, but should affect any future ones appended to the LogCat transcript.

You should use Log.d(tag, message). See here for the documentation.

try to use Log.d("message to show in log console")

Related

How do you toggle between Dimens/Strings id vs their actual value?

This question is kind of difficult to put in words, but I want to know how to toggle between the dimens/strings id's vs their actual values. The IDE is IntelliJ. An image should make it a bit more clear what I'm asking:
Upper image is actual values, lower image is with full id displayed. If you click on the 60dp, it will then display the full id. I'm interested in how to then revert it back to the original 60dp. I've spent some time trying to find it online and but couldn't find anything. I know that I could always just do a "go to declaration" on the id and find the actual value in strings.xml, but it would be significantly faster to just read it on the spot. Any other useful IntelliJ/Android tips someone could think of would be welcome too. If you could help me I'd be very happy.
On Windows press Ctrl+> to both expand and collapse when the cursor is within the value/code you want to perform Folding on or just use Ctrl++ or Ctrl+-.
This is called code folding and can also be found under the contextual menu (when you right click on the code) then Folding (See image below)

Why does Android Studio show quick docs for string literals?

Android Studio's quick doc pop-ups are buggy and occasionally unreliable, but one oddment in particular seems to occur all the time, which suggests it is a 'feature'. Behold:
Note the window title, 'Documentation for [string literal]' -- why would Android Studio consider a string literal to be a potentially javadoc documented code element? Can I disable this behavior without affecting legitimate quick doc pop-ups (e.g. those for field and method names)? Worse, sometimes Android Studio will place the doc window somewhere above the cursor (not pictured) so it obscures my view of the relevant code. Can the position of the quick docs window relative to the cursor be configured somewhere?
To answer your last question, the position of the documentation (quick docs) pop-up can be fixed:
When it is displaying, click the push-pin icon in the top-right of the pop-up to "Open as a Tool Window".
On this new tool window, click the gear-with-dropdown icon and uncheck "Floating Mode".
The window is then docked to the right side of the window by default but may be re-positioned or returned to a pop-up.

Force Android Studio to show light bulb

Say I type the following field
field = "I am field";
In Eclipse as soon as I place the mouse on field it shows me a list of options from which I can select create local variable field.
In Android Studio, the lightbulb is a headache for me. Sometimes it appears quickly, sometimes it takes forever to appear.
Is there a way to force it to appear?
Are you talking about using Alt + Enter?
This link might help:
https://www.jetbrains.com/idea/help/keyboard-shortcuts-you-cannot-miss.html
Pressing Alt + Enter results in the drop-down menu with correction options in this case:
In the Android studio Settings/Keymap "shortcut Ctrl+Alt+S"
search for usage of "Alt + Ent" as below image if its not assigned for any action plz go for No. 2
Android studio shortcuts
In the Android studio Settings/Editor/Intentions.
Check whatever you want to show Intention in are checked or not as below photo
Intention
Double check no.1 is working fine and you found usage of "Alt + Ent" shortcut
[You can find the solution on official Jet brains website]
Intellij IDEA keyboard shortcuts
Intention actions
Try putting the cursor right next to the last letter of the class/method you want to edit, in other hand what worked for me in Android Studio is to use the bar on the right side, 'Outline' and from there get to the part you want to edit and use the tools from Outline or by right clicking on the method that appears in the tree drop down.

Catch copy event android

I am programming a dictionary which has Instant lookup function. I wanna when I selected text and copy it, a popup is displayed (display this text and meaning of it). Firstly, I wanna display selected text.
Any idea and advice.
You can view this apps: QuickDict
I really like it,
If you are using API level 11 (3.0) or above, then you can use addPrimaryClipChangedListener which is documented click here and there is some example usage click here.

Eclipse Display Window doesn't work I can't run anything there

Eclipse Display Window doesn't work I can't run anything there.
For example I am trying to do this in the Display view window:
System.out.println("test")
But nothing happens, and when I looked in Eclipse documentationa and in the internet I found that the j icon on the upper right corner of the Display window should be active after I highlight the line of code or I can right click after I highlight the code and see the option to execute the code. but nothing is working.
Please help.
Try highlighting the text that you typed into the display window. You might be able to execute it once you do that.
This is because Display is used only when the code is being debugged. Put a Breakpoint in the code and while the process stops there, use Display to execute your code. It must work.
I am assuming that Consol Window is not opened in your eclipse. Just follow this steps,
Go to Window Menu
Select Show View
Select Consol ( or shortcut key is Alt+Shift+ Q C )
Just select the command like:
System.out.println("test")
and press Ctrl+U or right click on highlighted text and select execute. It will work.

Categories

Resources