I want to print the source code, Opened File-> Print.
In the print its printing the full file path on top. I want to print only the file name. How can I do this?
The Text line $FILE$ is printing the file path on top of the paper. I tried $NAME$,$FILENAME$, etc,. but not working? Any hope?
You can print the file name with $FILENAME$, Check IntelliJ IDEA documentation here.
Text line :- In this text box, specify the contents of the header or footer. If necessary, combine plain text with print keywords. By default, IntelliJ IDEA suggests to print the name of a file $FILE$ in the header and the current page number $PAGE$ of all pages $TOTALPAGES$ in the footer.
The following print keywords are recognized:
$FILE$ prints fully qualified file name.
$PAGE$
$DATE$
$TIME$
$FILENAME$ prints file name without path.
$TOTALPAGES$
Related
I am working inside a large legacy project that has a rich file structure. I know the name of the file I need to edit. But I don't remember where it is in the tree! In XCode I would use the filter in the project file view. But there doesn't seem to be something like that in Android Studio. What do I do?
You can simply press the Shift twice and enter the filename.
Shift + Ctrl + F or Shift + Cmd + F are usually used for searching for a specific word inside a scope be it the Directory, Module or the entire Project.
I thought of how to deal with this - using the Find in Path search (Shift+Ctrl+F or Shift+Cmd+F) search for "class ". Since file names correspond to class names in Java and Kotlin, you will get the file that contains the class definition in your list of results. If there are many classes that start with the same prefix, you can check the "Words" checkbox at the top of the Find in Path dialog.
I want to find all hard-coded strings in my code to move them into strings.xml file for future localization. Such as :
Toast.makeText(context,"Hardcoded text",LENGTH_SHORT).show();
I using Android Studio.
Go to Analyze > Run Inspection By Name... (Ctrl+Alt+Shift+I)
and type:
Hardcoded Text to find the hardcoded strings in
the .xml files;
Hardcoded Strings to find the hardcoded strings in the .java files.
Run it against the whole project, and you should get an inspection results panel that will show the hardcoded text instances.
This answer hasn't getting to me any result.
Nonetheless, for future searches :
In Android Studio 1.2.2 added new Option Hardcoded strings(not a Hardcoded text) and this getting to me perfect searches result.
After android studio 1.2.2 It seems pretty easy way to do it,
Go to Analyze
Run Inspection by name
Type : HardCoded Text
And then by selecting appropriate module's option you can get all hard coded Strings in your whole project.
Tip : Short key : Ctrl + Alt + Shift + I
It seems it has been already answered here, isn't it relevant for your problem ?
Edit : just don't forget to check "File mask(s)" box in the window after having typed "Hardcoded text", and select *.java, if you want to search in Java files.
And after you found all your hardcoded strings, this may help you to transfer them to XML.
Does anybody know of a way, or something that could ease the process of manually removing the extra strings, to get only the content of the "Text" column in the logcat view when copying the logcat content?
Seems not possible, but I've drawn an attention to it through android issues portal:
https://code.google.com/p/android/issues/detail?id=77883&thanks=77883&ts=1413891569
Hopefully it will be implemented soon enough, as it woudl be really helpful.
There are two ways to achieve that:
The First Way, if you have multiple lines:
copy your text to Notepad++ or any editor that uses Regex.
press ctrl+f and choose Replace tab.
use a Regex format in order to remove all the unnecessary tags info, for example in the case of System.out messages, the Regex formula will be:
\d*-\d* \d*:\d*:\d*\.\d*: I\/System\.out\(\d*\):
if the messages are like:
03-14 14:44:17.557: I/System.out(18293):
finaly, use this formula in [find what] field and use a white space in the [Replace with] field, and don't forget to choose Regular Expression choice in the (search mode) field.
The second way, if you have a single line of log: as described here:
Right click on the line in Logcat which you wish to copy text from
Click “find similar messages”
In the window that pops up the text is contained in the field “by Log Message:”
This text can now be copied via Ctrl+C
I am trying to create a PDF in my Android application using the Android PDF Writer. This is a very basic library that allows to create simple PDF files. It works quite well, but there is one thing I do not understand:
When I look at the generated PDF source code I can see, that the file starts with the following lines:
%PDF-1.4
%©»ªµ
1 0 obj
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
...
What does the second line mean? I searched a lot of different PDF syntax documentations but I have found no hint what that line could mean. In all examples I found the the %PDF-VersionXY line is directly followed by the first object / the catalog.
I am not sure if this is valid PDF code at all, or if this some an error due to some charset/enconding problem with the libraries source code.
Any idea what this could be about? What information could be included at this place and is %©»ªµ valid PDF or some enconding error?**
When taking a look at the pdf-1.4 reference here (or also in the current 1.7 here) in section 3.4.1 it says
Note: If a PDF file contains binary data, as most do (see Section 3.1, “Lexical Conventions”),
it is recommended that the header line be immediately followed by a
comment line containing at least four binary characters—that is, characters whose
codes are 128 or greater. This will ensure proper behavior of file transfer applications
that inspect data near the beginning of a file to determine whether to treat the file’s
contents as text or as binary.
So your generator seems to include this additional comment-line by default, even if there is no binary data to follow. What's in there doesn't matter as long as each byte value is > 128 (that is: outside the ASCII-range). In your case it's hex values A9 BB AA B5, so everything is fine and you don't have to worry about this line.
i can read the next line in a file stored in the assets folder.
But how do read the previous line by click of a button.
my file is stored in the assets folder
if you got a small size file, just read all previous lines starting from the first line to the line you can read or even to the last line , split them by "\n" and get the previous line by its index, this is not a good way, however i recommend you to post your code so we can help you better ^_*