Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
I have to edit the main.xml file of a program I'm working on (it's part of an exercise from an android book), but there are two different main.xml files in the Eclipse navigator. They are both respectively located in the "menu" and "layout" sub-folders. I'm not sure which one to modify, or if I should modify both. Here is the code I need to insert:

code:
<?xml version="1.0" encoding="utf-8"?>
<com.deitel.cannongame.CannonView
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:id="@+id/cannonView"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:background="@android:color/white"/>

The two different main files already in my project folder contain the following

(menu/main.xml)
code:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/menu_settings"
        android:orderInCategory="100" />
</menu>
(layout.xml)
code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:padding="@dimen/padding_medium"
        tools:context=".MainActivity" />

</RelativeLayout>
Which one should I modify? Also, the book doesn't say whether to append or overwrite. Should I append or overwrite?

Adbot
ADBOT LOVES YOU

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
I've been assigned the following program for my android development class:

Ninja Game

I can't figure out how to successfully import the AndEngine.java file into my project. Specifically, i'm stuck on the step where we need to create a "SimpleGame" class by extending the "BaseGameActivity" class from AndEngine. My eclipse (I'm using Juno) doesn't recognize a BaseGameActivity class to extend from.

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
Edit: I need to keep fewer forums windows open at the same time...

Harold Ramis Drugs fucked around with this message at 04:40 on Aug 4, 2012

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
I'm trying to use the AndEngine.java library for use in a school project, but I don't think I'm correctly adding it to the build path. There are some superclasses in the library that I'm supposed to extend into subclasses for the purposes of the game, but Eclipse is just not recognizing the library at all.

Here's what I'm doing:
1.) Create a new folder in this project's subfolder called "libs"
2.) move andengine.java to that subfolder
3.) right click on it and select Build --> Add to build path

From here, the AndEngine library appears under the "Referenced Libraries" subgroup (It's the only thing in there), and I can open up the AndEngine library to find all the superclasses I'm supposed to be extending. The IDE just doesn't recognize any of them when I try to call them in my code.

Edit: I actually fixed it by adding a specific import statement for one of the classes I needed.

code:
import org.anddev.andengine.ui.activity.BaseGameActivity;
which resolved this:
code:
public class AndEngineMinimalExample extends BaseGameActivity{
"BaseGameActivity" was unrecognized before, the first line of code fixed it.

However, is there any way to make the IDE do this for me? It did not recognize anything from the imported library until I specifically typed out that import statement by hand. None of the subclasses/methods appear in the intellisense

Harold Ramis Drugs fucked around with this message at 23:08 on Aug 4, 2012

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
Here's a video version of my problem:

http://www.andengine.org/blog/tag/tutorial/

I am able to follow the video up to about 1:50, when he changes the name of the extended class from "Activity" to "BaseGameActivity". He is actually able to do it with intellisense, and eclipse automatically added the correct import statement to the top. It won't do this for me.

The andengine jar file is sitting in my referenced libraries tab for this project. The IDE doesn't seem to recognize anything that's in it, including the above BaseGameActivity statement. (The correct import option selected in the video isn't even available to me).

mmm11105 posted:

That's mostly how java works, but you should be able to import something like
code:
import org.anddev.andengine.ui.*
to get everything (that's public) out of the anddev ui package at once. Adjust where the * goes to for more or less specificity.

This doesn't work. However, I forgot to note last time that the AndEngine.jar expands into a list of about ~100 different packages, each one with the objects I need inside. I was thinking the above import statement isn't working because the class files needed are contained within subdivisions of that directory.

Is there a more inclusive way to use the import statement to import all the classes from all the sub-directories of a jar?

Edit: I'm now considering that this might be a symptom of the new release of eclipse (Juno). All of our course materials were prepared for Indigo, so I'll revert to that version and see

Harold Ramis Drugs fucked around with this message at 01:20 on Aug 5, 2012

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply