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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:33:58+00:00 2026-05-31T01:33:58+00:00

I currently have a timer that ticks and changes the label to count down

  • 0

I currently have a timer that ticks and changes the label to count down the seconds.
Is is possible and if so how do i change and image in and image box to a custom value for each for example
Label=1 imagebox1=1.jpg
Label=2 imagebox1=2.jpg
Or would it the easier to go off the timer tick value?

  • 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-05-31T01:33:59+00:00Added an answer on May 31, 2026 at 1:33 am

    I would make a Sprite class. Then I would use the value from the ticker to cycle through the various bitmaps I need. But if the images are small enough resolution combine them in one Image and use an AniSprite…

    import android.graphics.*;
    
    public class AniSprite {
    
    public RectF target;
    public Rect source;
    public Bitmap bitmap;
    public int width;
    public int height;
    public float posx;
    public float posy;
    public int frames;
    public int curframe = 0;
    
    public AniSprite(Bitmap bitmap, float posx, float posy, int width, int height, int frames) {
        this.drawview = drawview;
        this.bitmap = bitmap;
        this.width = width;
        this.height = height;
        this.posx = posx;
        this.posy = posy;
        this.frames = frames;
        source = new Rect(curframe * width, 0, (curframe * width) + width, height);
        target = new RectF(posx, posy, posx + (width), posy + (height));
    }
    
    public void animate() {
        curframe++;
        if(curframe >= frames){
            curframe = 0;
        }
        source = new Rect(curframe, 0, (curframe) + width, height);
    }
    
    public void setSourceRect(Rect rect) {
        source = rect;
        curframe = rect.right/width;
    }
    
    public void ChangePos(float posx, float posy) {
        this.posx = posx;
        this.posy = posy;
        source = new Rect(curframe * width, 0, (curframe * width) + width, height);
        target = new RectF(posx, posy, posx + (width), posy + (height));
    }
    
    }
    

    So in this class instead of cycling through different bitmaps, I made one big bitmap that has each frame of the animation one after another. (use photoshop) the parameters tell the position on the screen x and y, the width and height of the frame (so each image), and the number of frames.

    executing AniSprite.animate() will switch the target to the new frame, thus you draw your sprite as

    canvas.drawBitmap(sprite.bitmap, sprite.source, sprite.target, null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET System.Threading.Timer timer that ticks every 60 seconds and introduces a
I have a database that is currently sharded. This is the first time that
I have a database with DateTime fields that are currently stored in local time.
I have a web application that currently sends emails. At the time my web
I currently have an MS Access application that connects to a PostgreSQL database via
In my WinForms application I have a timer which 'ticks' every second. In the
I have a table that stores stock ticks in sql server 2008. It is
Alright, currently I have my SWF hitting a php file that will go and
I currently have a game loop that fires off about 20 times per second
I currently have an application that spawns multiple instances of a single win form.

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.