Can't make another activity - android

I want another new activity in my project but i can not make it. I don't know what is the problem but the java activity shows red. Please help

You are probably having an issue somewhere in your XML-files which cause an error and so the R.layout-files can not be compiled. This is the reason why your activity_main2-Layout is in red. Unfortunately Android Studio does not highlight the file with the root error.

Invalidate cache and restart the android studio.

Place your cursor at the red labeled text. A dialog will prompt with more details about the error. Could you show us that error?
Also. It would be helpful if you paste the whole code of the Main2Activity, not a screenshot please.

Related

Is there any way out to solve this import' node:js' error of flutter?

I am new to flutter. Tried every possible to resolve this including importing the file to removing the file. nothing worked and Ienter image description here am pissed off.
click on the text in blue to see the CODE
dart:js is a web-only package. You simply can't use it for mobile apps. Hovering over the line in your code would have informed you about that

Alt + Enter wont open suggestions when pressed on empty spaces

I was using quick assist in Eclipse to quickly generate constructors when pointing on an empty space 1 line below a class declaration, after migrating to Android Studio i was hoping i could do the same.
Unfortunately on my Android Studio pressing Alt+Enter while cursor pointing at the first line after class declaration :
doesnt do anything! and i have to right click that postion and generate the ctor the hard and long way or write it by myself, is the quick assist not openning a bug or is it the way it is suppose to be?
if its a bug how can i fix it? if its not, what is the quickest way to generate a ctor?
i Believe you are looking for Alt+Insert.

Rendering problems missing styles after every update

I get the "Rendering problems. Missing styles. Is the correct theme chosen for this layout?" and the gradle resolving without end after every android studio update, making my entire code non runnable. Only solution is to just recreate my project. Is there any solution to this? It is really, really annoying.
Try to Invalidate Caches and Restart. In Android Studio go to the File menu and choose Invalidate Caches / Restart and confirm with Invalidate and Restart.
An image showing the appropriate menu item in Android Studio:
Simply click on the Refresh icon:          
Maybe a bit late, but this may help others...
Had the same problem and had another Error below: failed to find '?attr/textEditSuggestionItemLayout' with 9 similar errors not shown. The textEdit, which i made bold above made me thinking if the error had something to do with the TextView and if the missing styles relate to the TextView Styles. Although I had no more TextView´s in my Layout I gave it a try and added <item name="android:textViewStyle" >#style/AppTheme</item> and it worked, no more error messages to this. Maybe this can still help someone.
Happy coding

No Graphical layout editor in Android

I imported an Android project in Eclipse. Somehow, the layout editor does not open automatically when I open a layout! After I open it, it gives me the 'Graphical Layout' tab but it is still an empty frame! The only difference I see from my previuos projects is that the top drop-down menu has an option called "Locale" while the older ones had "Any locale".
Please advise.
Restart eclipse. I always close eclipse when this error happens and restarting it after that and my problem got resolved.
Something similar happened to me today and I found that if I closed the window/tab and opened again a few times it fixed itself. It was annoying though. Also try going into the xml tab and edit something in there and go back to the Graphical Layout.
Something similar happened to me a few versions of ADT for eclipse ago.
EDIT
Ok it has just happened to me once again. What I did to resolve was to change the Android version to something else. It's the drop down box beside the Create... button. That made it reappear
I have the same problem, it goes away if I switch to XML view and make a single edit, and then save. Then switch back to graphical layout and the error is gone.
It wasn't working for me no matter what I did. But it started working again when I deleted a bunch of projects in my workspace. My theme for eclipse was also deleted when I did this too, I'm not sure why.

XML Problems with Eclipse / Android SDK

I'm fairly new to eclipse and android development, and I'm having what must be a pretty simple error to fix. I've done some development on my laptop and never encountered these errors. (I currently only have access to public computers, and have eclipse and the SDK installed on a USB drive.)
The first strange thing I noticed when editing the main layout was that there is no properties window to allow easy editing of various layouts and objects. (There was on my old computer) I have not been able to figure out how to get this window to appear.
So after adding one textView and modifying its properties by hand, I receive the following two errors when I attempt to run the program. (No code has even been added yet, just one textView)
http://i.stack.imgur.com/9VGT0.png (Link to screenshot of error, only have 6 rep)
All I've done is change the textView to have center gravity, fill_parent layout width, and a textSize of 22sp. I've tried googling the errors to figure out what I'm doing wrong but have been unsuccessful. Anybody encounter this before? Also, if anybody knows how to make the properties window appear it would be a great help.
Thanks in advance
When compiling Android stuff in Eclipse, you have to press the "Run" button with a .java file open, not with .xml file open. No idea why, but the glitch is there and you'll soon remember to avoid it.
To fix the current state, delete the 'main.out.xml' file (it was automatically created on compile). Then in the 'Problems' tab (the one on your screenshot), manually delete each problem it shows you. After that, press Run again with a .java file open and it should solve whatever is there now.
You get the properties window back from the "Show View" dialog, which is accessible from the "Window" -> "Show View" -> "Other ..." menu.
Once the dialog is open, look in the "General" folder for "Properties".
right click the .xml file and go to Open With... there are many ways to open it. I prefer the xml editor but there is also a layout editor available.
Your XML is not well-formed, e.g. mismatched elements, mismatched quotes, etc. Show your XML for more specific assistance.

Categories

Resources