Android Studio Method doc for jar file - android-studio

I created a jar file using android studio exposing some methods and using the jar file in another android project.
For accessing any method when I type the first letter of method, the Android Studio intelliSense shows me different option of method names along with the parameters expected by these methods.
The parameters names that appear are (String s1, String s2) and so on instead of original parameters like (String Name, String Address) which does not gives a proper meaning.
What can I do to change this behavior?

Related

Android Studio kotlin file name is not recognized

The file structure and class name
So I have this file structure (checkout the link), as you can see, the Doctor is recognized normally, there is only one open class in the Doctor.kt class which is the Doctor class, and the HospitalDoctor.kt file also only contains HospitalDoctor class that extends Doctor, but it is recognized as a plain text file by the android studio, if I change it to any other name such as "my class", "newclass", and even "HospitalDocto" (miss a r at the end) it will be recognized as a class file as it should be. As AS think this file is txt, it shows error when I create a HospitalDoctor instance(unresolved reference), but it can actually run normally without any error. And the same project if I open with any other IDE like Intellij, it doesn't have this weird issue. What's going on with my Android Studio and how to fix this?

Visual Studio 2019 - CMake Linux - Where to get list of macros?

When working with the CMake Linux project in Visual Studio 2019, every json file (e.g. task.vs.json, launch.vs.json) magically uses macros like:
${workspaceRoot}
${env.xxx}
${debugInfo.xxx}
${cmake.xxx}
How can one know the full list of options when documentation is scarce, and IntelliSense does not help? For the case of MSBuild, usually there will be a window of all the possible variables, along with their resolved values.
As an aside, is there a way to define variables at a per-user leve, so files like launch.vs.json can take take it in? For example, defining targetAddr=192.168.1.2, and then use ${targetAddr} in the json file. One method is to define the variable in the json file itself, but I wish to commit the file as a "default" for team members, and let team members inject values through variables, without making the json file "dirty".

Android studio - custom 'Remove unused resources'

I'm trying to remove unused string resources.
In android studio, there is an option to remove unused resources. My issue is that I have a separate file that contains strings keys. At runtime I'm parsing this file and then fetching strings based on these keys. When running the remove unused resources option in android studio it can't detect that these keys are being used because they aren't referenced from code or xml.
Is it possible to somehow setup a rule in android studio to take in consideration this custom file I have?
I ended up writing a script that parses the custom file and creates an enum that holds a reference to the strings that should be kept. Generated enum looks like this.
enum class StringsToKeep(#StringRes stringRes: Int) {
STRING_KEY(R.string.string_key),
STRING_KEY_TWO(R.string.string_two),
}

Visual C++ Release build - is string getting corrupted when passed across DLL because compiled with different runtime version?

After building in Release mode, I am seeing exceptions which didn't occur in Debug mode. When debugging the release build, it looks like string references are not being passed correctly from the EXE (our application) to the DLL which is receiving the string reference.
Our EXE code looks like this:
string contents = "handle_message(): received=" + msg->encode();
LOG4CXX_DEBUG(logger, contents);
The LOG4CXX_DEBUG is going to log4cxx.dll, whose code looks like this:
CharMessageBuffer& CharMessageBuffer::operator<<(const std::basic_string<char>& msg) {
if (stream == 0) {
buf.append(msg);
} else {
*stream << msg;
}
return *this;
}
Looking at the Call Stack in the debugger, when I navigate down to the frame which has our source, I can see that contents is a valid string with size=583, capacity=838.
In the frame inside the log4cxx.dll (the next frame above in the stack) the string reference shows size=838, capacity=363113231 (and the values are all garbage).
Both our app and log4cxx.dll were compiled on the same machine, using the same runtime settings (/MD), but different versions of Visual Studio. The log4cxx dll was compiled using Visual Studio 2008 and our application was compiled using Visual Studio 2010. Running dumpbin on the 2 objects shows:
Our App (EXE)
MSVCP100.dll
MSVCR100.dll
log4cxx.dll (DLL)
MSVCP90.dll
MSVCR90.dll
Is this problem due to the fact that they are using different runtime versions?
If you pass non-POD (plain old datatypes) between DLL/EXE boundaries (like STL string or CRT FILE pointers) you must use the same shared CRT.
In your case, you must recompile all DLLs/LIBs with the same compiler!
See also: I can pass std::string for a Dll and what i can do with DLL´s?
The implicit question is:"Is there a way to pass data, hopefully using string and other STL containers, to DLLs of another version of visual studio either previous or later than the one that I'm using?".
Aside from using POD, there are probably three approaches: shared memory, sockets( to local host ) and MSMQ. All of these methods require additional extensive programming, but the deeper answer is found in how the interface is changing the input parameter.
I have found a possible solution to the string passing problem on the internet. It removes one layer of corruption; cast a pointer to the container to a uint and pass the uint. Dereference the uint to the pointer and the object is revealed. Beware, auto_ptrs are usually deleted in this process, so don't use them. If the passed object is still offset incorrectly( this happened to me with VS08 passing to a VS13 ), then pass the c_str() of the string instead. It's certainly inelegant, but we need to know all the alternatives. See "HowTo: Export C++ classes from a DLL" in Code Project( Nov 22, 2012 ).

Can't link known file extensions to custom editor classifier

I am working on an editor classifier extension for classic Visual Basic source files (module- and class files). The project has been created using the editor classifier project template from the Visual Studio 2012 SDK. The wizard created three code files: one for the classifier, one for the classifier-format and -provider and another one containing classification definitions. I made the following changes to the last one in order to link *.bas and *.cls files to my custom classifier...
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
internal static class MyEditorClassifierClassificationDefinition
{
[Export(typeof(ClassificationTypeDefinition))]
[Name("MyEditorClassifier")]
internal static ClassificationTypeDefinition MyEditorClassifierType = null;
[Export]
[Name("custom")]
[BaseDefinition("code")]
internal static ContentTypeDefinition MyContentDefinition = null;
[Export]
[FileExtension(".bas")]
[ContentType("custom")]
internal static FileExtensionToContentTypeDefinition MyModuleFileExtensionDefinition = null;
[Export]
[FileExtension(".cls")]
[ContentType("custom")]
internal static FileExtensionToContentTypeDefinition MyClassFileExtensionDefinition = null;
}
The problem is, that Visual Studio does not invoke my classifier for files having *.bas, or *.cls extensions, instead the built-in editor for Visual Basic is used. I already tested my editor classifier using a custom file extension; in that case the classifier works as expected. I would like to know, if it's possible to change the classifier for known file extensions.
I found an intresting solution for classifying keywors are already classifyed by a language service. It's description says it uses a Tagger to enhance code highlighting. Maybe it can help you: KeywordClassifier
Older version of the linked project used a classifier mentioned in the description.
You can get the name of the loaded document, also the extension with ITextDocumentFactoryService or maybe there is a way to bind the tagger also to extensions not only to the content type of Basic (instead of code). FileExtensionAttribute may help.

Resources