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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:00:26+00:00 2026-05-29T05:00:26+00:00

I am working on a 360 degree image rotator in Android as shown in

  • 0

I am working on a 360 degree image rotator in Android as shown in this link:
http://developer.apple.com/safaridemos/showcase/threesixty/

For this use case, I am simply using more than 40 images to be shown at different angles when user scrolls horizontally.
using this code:

public boolean onScroll
      (MotionEvent e1, MotionEvent e2, float distanceX, float  distanceY) 
 {      
    Log.i(TAG, "distanceX = "+distanceX);
    if(distanceX > 3){
        if(imageCounter < imgArr.length - 1){
            imageCounter++;             
        }else{
            imageCounter = 0;               
        }
        imageSwitcher.setImageResource(imgArr[imageCounter]);

    }else if(distanceX < -3){
        if(imageCounter > 0){
            imageCounter--;
        }else{
            imageCounter = imgArr.length - 1; 
        }
        imageSwitcher.setImageResource(imgArr[imageCounter]);
    }
    return true;
 }

My problem is that the switching in images is not smooth enough. A look at Logcat tells that with every 2-3 switches in images, Garbage collector does its work and takes around 20 milliseconds in finishing its job everytime. These few milliseconds are causing problem in attaining a smooth 360 degree rotation.

  • 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-29T05:00:28+00:00Added an answer on May 29, 2026 at 5:00 am

    You could try changing imgArr to a Bitmap array and then using setImageBitmap instead of setImageResource. If you are only using 40 images you should be able to fit all those in memory. There will be a slight delay on startup (should be <1 second on a newer phone) to load all the Bitmaps but it should make it smooth, the GC will not collect the Bitmaps if they are still referenced.

    It may not even be the GC to be honest. Using setImageResource causes the Bitmaps to be read and decoded on the UI thread, which may be causing your latency issues. This is noted in the docs here.

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

Sidebar

Related Questions

I'm interested in those 360-Degree video you can find on the web (like http://www.slopeviews.com/onsnow-beta/
I have this script I am working on that utilizes the oCanvas JS Library
I cannot for the life of me understand why this code isn't working. I
I have this string: £1,134.00 (£1,360.80 inc VAT) And I am trying to extract
Simple question. Consider this vector: [1] 378 380 380 380 380 360 187 380
Heads up: Even though this problem arose while I was working with Unity, it
Working on a pet project concerning efficiency and data and this is the mission
I'm working with an example from this site on OSX and I have no
I'm working on a game in XNA for Xbox 360. The game has 3D
Working with dates in ruby and rails on windows, I'm having problems with pre-epoch

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.