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 8799373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:18:27+00:00 2026-06-14T00:18:27+00:00

I have an Android app that shows a frame-by-frame animation activity. At the end

  • 0

I have an Android app that shows a frame-by-frame animation activity. At the end of the animation it starts a background service and closes the activity. Here is the code:

    cont = getApplicationContext();

    final ImageView img = (ImageView)findViewById(R.id.img);
    img.setBackgroundResource(R.drawable.intro);

    img.post(new Runnable() {           
        public void run() {
            animation = (AnimationDrawable)img.getBackground();
            animation.setOneShot(true);
            animation.start();
            timer = new Timer();
            timer.schedule(new timer_exp(), 3400);
        }
    });
}



class timer_exp extends TimerTask{
    @Override
    public void run() {
        //start service
        Intent serviceIntent = new Intent(cont, MainService.class);
        startService(serviceIntent);
        //kill activity
        finish();           
    }

}

When I run the app I can see the animation and then the service starts. When I press on the app’s icon again, I get a black screen and the app crashes.

Any Ideas to what the problem might be?

Thanks,
PB

  • 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-14T00:18:28+00:00Added an answer on June 14, 2026 at 12:18 am

    After some investigation, it turned out that the service was the problem.
    I had some Thread.sleep() in several places that caused the UI thread to crash.
    After adding another thread for these actions the problem solved.

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

Sidebar

Related Questions

I have a simple app that shows android notifications depending to one of three
i have an android app, that shows some fragments after swiping, the textView in
I have a Opengl ES 1.x ANdroid 1.5 app that shows a Square with
I'm developing a RSS reader android app. I have a ListView that shows my
I have a activity on my app, that shows a lot of options that
I have Android client app that communicates with server using Socket . On my
I have an android app that I am trying to launch and it gives
I have an Android app that has an Application class and I have another
I have an android app that plays audio from the application class. I have
I have an Android app that I had working a few months ago which

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.