I am beginning to learn developing apps on android studio through android training website. I followed the steps and created an empty project. However I included c++ support while creating project. So when i ran the project, the output is "Hello from c++" from native-lib.cpp instead of "Hello World" in activity_main.xml.
My question is:
How do I get it to execute activity_main.xml and print hello world rather than native-lib.cpp?
Answered here:
If you're just changing the XML, but haven't changed the source code for the new project, then your XML is going to be overridden by the line
tv.setText(stringFromJNI());
Remove that line (or set your new text there instead) to fix your issue. It's caused by the fact that the XML is the starting point for your view, so any and all changes to that view during runtime will be the ones that you're likely to see.
Related
In my Android Studio project i used to have a class FileHandlerImpl with a function onFilePartReceived and inside there i had a command that prints in the Logcat ## File part received ${some data}. Two months now i have changed the whole API of that part of the app, so i have deleted that methods and of course the println command. However, there are some times that i see that in my Logcat appearing like it does exist. However, if i search inside the Project by Right click -> Find in files..., I never find that line. Of course i am sure that i have deleted that and it does not exist. How does this still appear in the Logcat..? Has anybody faced that issue before??
A couple days ago I tried to initialize Visual Studio Code to be able to code in C++ using online instructions. They ended up not working at all, but I had edited some settings files (such as a .json file) in Visual Studio Code that I thought were all C++ specific. Afterwards, however, I no longer have the convenient "run | debug" buttons appearing above any "main" functions that I make in java files. In the past I used to be able to just click run and my program would run in the terminal at the bottom of the screen, as opposed to manually compiling and running the program using a terminal. I am running Windows 10. Does anyone know of any way to get these buttons back?
This is an example of what the two buttons look like, appearing above any main functions in a java program.
I also found on the Visual Studio Code website a description of how to begin debugging, attached here, that describes that you need Language Support for Java(TM) by Redhat in order to get these two buttons. I have this extension downloaded, but it is still not working. Please help if you recognize this issue!
What worked for me:
Make sure you have Java extensions, Java Debugger and other basic Java packages installed.
Then making sure the main function is formatted properly like below allowed the Run|Debug buttons to be seen.
public static void main(String[] args) {}
First of all, for troubleshooting, actually we need to have a reproduce steps which can understand what happened in your environment. So can you tell us what you have done to your settings first?
Second, there is a setting under common setting tab, that is Java>Debug>Settings>Enable Run Debug Code Lens. Please check whether this option has been unchecked. Although I think it should not be changed by you.
InstallShield must be the crappiest "industry standard" application in existence, for reasons too numerous to enumerate here. However, one of those deficiencies is something I'd like to be able to fix, and with my first foray into writing an extension for Visual Studio (currently using 2015 version).
InstallShield has created a .isproj type, to allow integration with Visual Studio. This allows a developer to create an installer that references the output of a project as the files to include in the installer (rather than having to manually select individual files to include). This works well enough as long as the .isproj is being built in Visual Studio, and in a solution that references the project for which you need the output.
However, I also have an automated build for my installer projects, that we run on a build server using MSBuild. When attempting to build this way, we were getting completely opaque error messages indicating that the project output references above couldn't be resolved.
As with all InstallShield errors, Googling for answers turned up nothing except for multitudes of other people having the same problem. So I decided to dig into the plain text of the .isproj to see what I could find.
As it turns out, the .isproj type is a just a regular MSBuild script, and it even has lines commented out that explain options that can be added to the project; one of those things that can be added is an ItemGroup containing ProjectReference nodes. Manually adding the nodes helped solve the problem. Command-line build now works.
However, I am dissatisfied with a) having to manually type this stuff in, b) having no visual representation of what projects are being referenced, and c) not finding out about a problem until the build fails. So, I would like to be able to extend Visual Studio to help me with this. Here's what I'd like to do:
1) Add a "References" node to the project in Solution Explorer that acts like the References node for any normal .csproj.
2) Restrict the available References to other projects in the the current solution.
3) Visually represent a project with missing references (e.g. by underlining the project name with a colored squiggly, as with errors/warnings), and potentially failing the build if missing (depending on whether I want to treat it as an error or a warning; TBD).
To these ends, I've downloaded MPF for Projects - Visual Studio 2013, which provides an SDK for creating a new project type.
However, before digging too deeply, I need to know if it's even possible to EXTEND an existing project type, as described above, as I obviously don't have InstallShield source code. Also, any links or guidance as to a starting point for doing so would be greatly appreciated.
Hi I am new to programming and wanted to create a new project in Android Studio for experimentation.
I wanted to start with the Empty activity which creates the Hello World program but suddently its no longer possible. The window which I get when I click
is compleatly different.
Instead of getting the window which lets me select the target API and activity type I get this
And from there It only lets me select project name and whether or not it creates the basic main main java method. No XML no nothing.
I dont know what happened
EDIT: I would like to add that I deleted .gardle yesterday once because it was a solution to another problem I had earlier
I solved this myself by resetting Android studio by deleting .AndroidStudio2.3
Resetted all setting which sucks a bit, but I rather have that.
I'm a beginner to android but have done a little with an older version of Android Studio, and in the new version I'm having a lot of trouble getting the java file to find buttons or ImageViews. I'm not sure if it's related to the content_main vs activity_main thing. I'm having trouble finding any answers as to how this works on Google, so I'm just starting here, I want to put a button on the main page of my app and have the java file that correlates to the XML file find it. How do I do this?
Answers online are very vague to me, things like "activity_main.xml will determine how the look of the main activity should be. And on the other hand content_main.xml will determine the contents in the activity_main.xml" does not mean anything to me. Please tell me where to put the button!
If you are adding a button in activity_main rather than content_main it cannot be recognized by your Java file. Not only that is will even not be visible on your app.