Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8147835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:29:06+00:00 2026-06-06T14:29:06+00:00

I’ve been trying for a while to get my app to move to its

  • 0

I’ve been trying for a while to get my app to move to its next class, “GameOver.class”. Could someone point out what I’m doing wrong? According to my log the OnAnimationEnd method is not even being hit. The class, GameOver does work if I use it as the main class.

public class Rocky extends Activity implements AnimationListener {

TextView m_dog, m_spoon, m_ice_cream, m_car, m_giraffe ;
ImageView rocky_pic, dog, spoon,ice_cream, car, giraffe;
Animation animationFadeOut, animationFadeIn,viewObjFades;
int count = 0;
MediaPlayer mp;
private static final String TAG = "MyActivity";
AlertDialog.Builder builder;
AlertDialog alertDialog;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.rocky);

    rocky_pic = (ImageView)findViewById(R.id.rocky_pic);


    Animation animationFadeIn = AnimationUtils.loadAnimation(this, R.anim.fadein);
    rocky_pic.startAnimation(animationFadeIn);

    m_car=(TextView) findViewById(R.id.m_car);
    m_dog=(TextView) findViewById(R.id.m_dog);
    m_spoon=(TextView) findViewById(R.id.m_spoon);
    m_ice_cream=(TextView) findViewById(R.id.m_ice_cream);
    m_giraffe=(TextView) findViewById(R.id.m_giraffe);

    dog = (ImageView) findViewById(R.id.dog);
    spoon = (ImageView) findViewById(R.id.spoon);
    ice_cream = (ImageView) findViewById(R.id.ice_cream);
    car = (ImageView) findViewById(R.id.car);
    giraffe  = (ImageView) findViewById(R.id.giraffe);

    mp = MediaPlayer.create(Rocky.this, R.raw.ding); 
    dog.setAlpha(0);
    spoon.setAlpha(0);
    ice_cream.setAlpha(0);
    car.setAlpha(0);
    giraffe.setAlpha(0);

}



@Override
public void onStart() {
    super.onStart();

    LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.custom_dialog,
                                   (ViewGroup) findViewById(R.id.layout_root));

    TextView text = (TextView) layout.findViewById(R.id.text);

    text.setText("Text.text.text");

    builder = new AlertDialog.Builder(this);
    builder.setView(layout);
    alertDialog = builder.create();
    alertDialog.show();

    text.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            alertDialog.dismiss();

        }
    });



    alertDialog.setCanceledOnTouchOutside(true);


    ice_cream.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v)
        {
            ice_cream.setAlpha(200);  
            count ++;
            mp.start();     
            ice_cream.setClickable(false);
            if (count==5){

                fadeout();
            }
        }
    });


    dog.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v)
        {
            dog.setAlpha(200);  
            count ++;
            mp.start();     
            dog.setClickable(false);
            if (count==5){

                fadeout();
            }
        }
    });


    giraffe.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v)
        {
            giraffe.setAlpha(200);  
            count ++;
            mp.start();     
            giraffe.setClickable(false);
            if (count==5){

                fadeout();
            }
        }
    });

    spoon.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v)
        {
            spoon.setAlpha(200);
            count ++;
            mp.start();
            spoon.setClickable(false);
            if (count==5){

                fadeout();
            }
        }
    });     

    car.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v)
        {
            car.setAlpha(200);
            count ++;
            mp.start(); 
            car.setClickable(false);
            if (count==5){

                fadeout();
            }
        }
    });


}



public void fadeout(){


    animationFadeOut = AnimationUtils.loadAnimation(this, R.anim.fadeout);
    animationFadeOut.setAnimationListener(this);

    viewObjFades= AnimationUtils.loadAnimation(this, R.anim.trns4view_fadeout);



    car.startAnimation(viewObjFades);
    giraffe.setAnimation(viewObjFades);
    spoon.setAnimation(viewObjFades);
    dog.setAnimation(viewObjFades);
    ice_cream.setAnimation(viewObjFades);


    rocky_pic.startAnimation(animationFadeOut);

    car.setVisibility(View.GONE);
    giraffe.setVisibility(View.GONE);
    spoon.setVisibility(View.GONE);
    dog.setVisibility(View.GONE);
    ice_cream.setVisibility(View.GONE);
    rocky_pic.setVisibility(View.GONE);

}


@Override
public void onAnimationEnd(Animation animation) {
    mp.release();
    Log.v(TAG, "player released");

    Intent end = new Intent(this, GameOver.class);
    Log.v(TAG, "end object created");
    end.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    Log.v(TAG, "no anim");
    end.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    Log.v(TAG, "sing t");
    this.startActivity(end);    
    Log.v(TAG, "begin game over");
}




@Override
public void onAnimationRepeat(Animation animation) {

}

@Override
public void onAnimationStart(Animation animation) {

}


@Override
public boolean onCreateOptionsMenu(Menu menu){
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.rcky_menu, menu);
    return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu){


    if(!dog.isClickable()){
        menu.removeItem(R.id.m_dog);
    }
    if(!spoon.isClickable()){
        menu.removeItem(R.id.m_spoon);  
    }

    if(!ice_cream.isClickable()){
        menu.removeItem(R.id.m_ice_cream);
    }

    if(!car.isClickable()){
        menu.removeItem(R.id.m_car);
    }

    if(!giraffe.isClickable()){
        menu.removeItem(R.id.m_giraffe);
    }

    return true;
}
@Override
public void onBackPressed(){

}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:29:08+00:00Added an answer on June 6, 2026 at 2:29 pm

    You’re setting rocky_pic’s visibility to Gone as soon as you start the animation on it. Since it’s a fadeout animation, shouldn’t you simply set the animation to fill_after so that it stays gone when the animation finishes? I think setting it to gone, might stop the animation completely and therefore the animation is effectively cancelled which is why onAnimationEnd never gets called bc you effectively invalidate the view by changing its visibility.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.