Link to home
Start Free TrialLog in
Avatar of jagguy
jagguyFlag for Australia

asked on

cant run android more than once

I cant run an android app more than once in eclipse.
The default 'hell world' app only runs once.

After running the 'hello world' app once and it works I then close the emulator, and then hit run again. The program then hangs and doesnt do anything.

I dont remember this happening before?
Avatar of for_yan
for_yan
Flag of United States of America image

If you don't close the emulator - does it run again in the same emulator ?

(Change the text of Hello, ... so that you see)
Did you go to Windows - AVD menu and set the checkbox on the emulator
(shows green chcheckbox), and select automatic

Even though I had only one slection there but before I did that it on each run created new emulator and it took a long time. After I did that itjust replaced my application in the existing emulator - it was much faster.
True, I didn;t exoerience that it hanged though even when it created new emulator.

and if it hangs - if you then restart Eclipse - would it run again OK for the first time after Ecliopse restart?
Avatar of jagguy

ASKER

I run the program ok.

if I change the  text to hello world 2 and run it again nothing happens other than the program tries to run again and it doesnt.

How do I edit the file and re-run the program without waiting a few minutes each time for the emulator to load?
>How do I edit the file and re-run the program without waiting a few minutes each time for the emulator to load?

That is exactly what I achieved after I went to Windows - AVD and set the checkbox on the emulator and set checkbox to aoutomatic

after that it didn't create a new emulatorbut just put new version of program to the saem emeulator  (but you should not clsoe it of ciurse after the first run)
Avatar of jagguy

ASKER

i go windows - avd manager and see 2 devices with green ticks I created before.

there is no automatic option?
Avatar of jagguy

ASKER

I also tried the run config automatic options , change the code and rerun the program without closing emulator.

still no good
Yes, automatic is in different place - go to Run Configurations - then sleect Target tab - there I guess you'll need to have only one of two emulators checked and on top left there is automatic checkbox
I have only one emaulator - os in target screen I have that one checked and automatic checked also
Avatar of jagguy

ASKER

this doesnt do anything for me. I checked automatic and have the correct program on left pane and auto checked with emaulator 2.2 (choice of 2) but I select 1 of course.

then i change my code 'hello world 3' and click run....nothing happens on emulator as there is a program trying to run in the background and hangs at 27%


How do I change my code and get the emulator to display new code without closing emulaor from last time I run the pogam?
where do you cahnge your code to hello world 3 - post your code

>hangs at 27%

what that means ? and where do you get %

and what happnes when you close Eclipse and start Eclipse again
Avatar of jagguy

ASKER

package com.home;

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


public class Thome1Activity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android 3");
        setContentView(tv);
    }

}

I run this and it works.
If I change   this line
  tv.setText("Hello, Android 3");

to

    tv.setText("Hello, Android 4");

and hit run , the emulator doesnt display the new code. in Progress tab in eclipse it says 27% and tries to keep running new code (it just repeats)
Yes, that is correct code and works for me
Avatar of jagguy

ASKER

when you change the code what do you do?
do you simply click run again ?

what is the process for changing code and running the code again without waiting for the emulator to load again.
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If I were you, I'd try to create a new project - maybe something gits screwed in that project
I am also running everything in 4.0.3
Avatar of jagguy

ASKER

yes it worked in 4.03 as your instructions said  but not in  android AVD 2.2

so I dont want to code for 4.03 as it is too new, what do I do?
Avatar of jagguy

ASKER

ok it worked.

I had to create a new project again.
Good!