Eclipse doesn't create acivity_main in /src automatically - android

I have the newest version of Eclipse (32 bits) and I can't create any activity. Even if i make New -> Other -> Android activity it also doesn't make it. I have Windows 8.

When you create a new Android project by default the activity "MainActivity" and layout "activity_main" are created.
the message activity_main already exists is displayed.
If you want to add another activity with New -> Other -> Android Activity you have to change the name :P.
UPDATE:
https://code.google.com/p/android/issues/detail?id=66647

Related

Where is the "content_my.xml" file in Android Studio?

In the training docs, it says that the content_my.xml should be in the layout directory. But as you can see in the picture below, it is missing from there. What can I do?
Probably You have selected EmptyActivity instead of BasicActivity during creation of the project.
Go to File -> New -> Activity -> Basic Activity to create it in the same project or just start another project.

Change behavior of "Add new Android Components" on Android Studio

I am having a problem with my build.gradle file every time that I insert a new Fragment from AndroidStudio. When I use the tool that AndroidStudio provides to insert a new component such as fragments or activities, it creates the fragment class .java and the associated layout, but it also modifies my build.gradle, for example, my dependencies are reordered but the build.gradle file is broken after that because the order is not done properly. I attach an image with the example.
Why is it behavior happening and how could I prevent it?
I am using AndroidStudio v2.1.1 stable channel

Creating Activity | Android Studio ? [Some concerns]

Till Eclipse, creating a second activity and class had a brevity . However, with the new official Android studio , I feel more of an abstraction . Earlier, while creating an activity it specified many things, nevertheless asked the layout of an XML file. And here are my doubts:
1) Is there an option to create Java file in Android Studio just like we use to do with Eclipse ?
2) Which is the best way to create an activity in Android Studio with our specified layout?
1) You can go into the project directory and right click the folder where you want the activity to be (typically in src/java/com.xxx.xxx/) and select New -> JavaClass and create YourActivity and make sure that YourActivity extends Activity. Be sure to add the activity to your manifest!
2) There is no best way as it is a matter of preference. Personally I do what I said in step 1 and create the xml layout file myself in the res folder. I find that Android Studios auto activity creation to be a bit annoying as they add menu xml files that I do not need.

While Creating a new project

I updated my SDK and my Eclipse Juno IDE.
While I'm creating a new android project I follow these steps,
images:
Now, when I click on "Finish", the "Create Project" window doesn't get closed. Though the Project is still created but lots of errors.
Why it always tries to extend "ActionBarActivity" instead of "Activity", even I selected "API 8" as the minimum SDK?
Why there are errors? How to fix those?
In the wizard dialog you show in your first image set everything to be API 8 (min SDK, target SDK and Compile with options) and set Theme to None.
In the dialog you show in your second image uncheck the "Create activity" checkbox.
That's it. You'll get a blank project although you'll have to add your own Activity class (right-click the /src directory then New and add class and derive it from android.app.Activity) and you'll also have to create your own XML layout file.
ActionBarActivity is class from comparability library, and if you want to use action bar in app for API less then 11 you need to use it. Add comparability library to your project.

Eclipse Android setting up a test project

I added a Test project to my main project like it's shown here.
However, when I try to right click and go New -> Class to add a test class, the src folder is set to my main projects source folder, and the package is set to my main projects' package, and the test/ folder doesn't show up when I click on browse.
How do I set the test directory up properly, in Eclipse?
When you click on new class, you get the popup window, where you can set the new package name. (If you're not looking for this, then you should try out new thing below).
You can click on the package(which was created when you made new project), right click that package, then go new and new class to set up properly.
I hope this answer's your question.

Categories

Resources