• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Reverting AVD state?

qoncept

Newbie
I just toyed with the SDK for the first time last night. I have the latest version of the SDK, Eclipse 3.5 and everything all set up and ready to go. I was working through the hello world example to get a feel for it and found that the second time I ran the app, the AVD didn't behave the same way as it did the first time at all, and my changes weren't being reflected. After the first time I ran my app, the AVD would start locked and then show the hello world app as it was compiled the first time I ran it. What am I doing wrong.

I also want to say I don't have a clue how I'd search for this, so if it's been discussed, sorry! Thanks for the help!
 
Hello qoncept

I am not quite sure I understood your problem.
So you made changes to the code and ran it, but it showed like the first time you ran it? If so:

this.setContentView(R.layout.main); This loads the layout defined in main.xml (which contains a TextView that shows "Hello World"). Have you maybe forgotten to remove / change this?

If you have; Restart the emulator and eclipse and see if it works now. Check the console for hints on what might go wrong (The app may not be getting reinstalled).

Try to remove the app using the emulators Settings->Applications Menu. Then run it again from eclipse.

Hope that helps.
Cheers
 
Well, I started over because no matter what it wouldn't show my changes.. and now whats happening doesn't make any sense at all to me.

Hello.java (main activity):
Code:
package com.newrage.hello;

import android.app.Activity;
import android.os.Bundle;

public class Hello extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
main.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:text="@string/hello"/>
strings.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello, Android! I am a string resource!</string>
    <string name="app_name">Hello, Android</string>
</resources>
The output should be "Hello, Android" as the app title and "Hello, Android! I am a string resource!". Right?!

For some reason, it's displaying "Hello World, Hello!" I don't have a clue where that's coming from or why.
 
Well, I did some more playing and apparently somehow I made changes in the filesystem outside of Eclipse and it wasn't showing them, even after I quit and reopened it. Then it magically did. Dumb mistake, but not my first. Now, to make something useful. :)
 
Back
Top Bottom