-1

![I am developing an application where the user can trace the path of a letter.

  1. There is an animation(moving butterfly) which shows the path of the letter to be traced.
  2. The animation of the app is working fine but coordinates of the position of the animation of the butterfly are hard coded.
  3. But when i tried to run same app on larger screens, the animation of butterfly is not in sync with the letter.
  4. The screenshots of the application which are taken on the large screen(with animation out of sync with respect to the letter) can be seen.

Now my question is, How to determine the position of the letter and dynamically adjust the butterfly animation irrespective of the screen size and the orientation.

https://i.stack.imgur.com/3oszz.png

above picture is the correct path of the butterfly animation

https://i.stack.imgur.com/gbAqx.png

above picture is the incorrect path of the butterfly animation

Please help me and thanks in advance.........

  • What exactly do you mean by "not matches"? Can you upload screenshots and the code that does the drawing? – Anton Cherkashyn Nov 12 '12 at 07:34
  • First butterfly will follow the Alphabets path means...if A is there it will from Top to bottom ...then we have to touch that path...i done with paint....it is working fine for normal screens..whenever coming to larger screens like ...1024*600 screen sizes..The alphabet is somewhere and the butterfly following is somewhere...it shouldn't happen like that ?.....where the alphabet is there,there only it should be follow the alphabet path.... – user1808439 Nov 12 '12 at 07:42

3 Answers3

0

The whole description of your problem is a bit unclear but I would guess you have to add some scaling factor to your drawed path/alphabets path to reflect the different screen size. The scaling factor should already be known from the code that builds up your screen.

Elmi
  • 5,899
  • 15
  • 72
  • 143
  • Hm, what kind of reference? You need to a) multiply all x ynd y coordinates with a scale factor for x and y or b) give some more detailled information regarding your problem ;-) – Elmi Nov 12 '12 at 13:58
  • So simply question back to you: do you scale the hardcoded coordinates according to the larger screen? – Elmi Nov 14 '12 at 06:14
  • Please see the updated question and screenshots for the reference and some clear information about my problem,thanks in advance. – user1808439 Nov 14 '12 at 06:24
  • This question already was a result of your updated question :-) – Elmi Nov 14 '12 at 06:46
  • no i didn't hardcoded the coordinates according to the larger screens. – user1808439 Nov 14 '12 at 07:02
  • without hardcoded the coordinates to the larger screens,can't i get it. – user1808439 Nov 14 '12 at 08:28
  • No, you don't have to hard-encode the coordinates for every screen-resolution, just multiply them with a scaleX- and scaleY-factor that fits to the other, larger (or probably smaller) screen. – Elmi Nov 14 '12 at 09:21
0

Google have a new feature in their dev console which allows you to post different .apks for different screen sizes. But because you dont want to change the picture size, it seems unlikely that you would want to do that.

You could try using that, or you could change you butterfly's path depending on the screen size

if ((getResources().getConfiguration().screenLayout & 
Configuration.SCREENLAYOUT_SIZE_MASK) ==  Configuration.SCREENLAYOUT_SIZE_XLARGE) {
// set the path of the butterfly for tablets
}else{
//set path of the butterfly for phones
}

Getting the screen size of an android device

If you want to be more specific and set the path of your butterfly depending on the exact screen size then this might help -

Community
  • 1
  • 1
jcw
  • 5,132
  • 7
  • 45
  • 54
  • Please see the updated question and screenshots for the reference and some clear information about my problem,thanks in advance. – user1808439 Nov 14 '12 at 06:24
  • Yes, I don't know how you would rescale images, I am suggesting that instead of moving the images, you change that path that the buttryfly follows – jcw Nov 14 '12 at 06:32
0

Are you making that butterfly to traverse a path defined by the pixel value of the alphabet's possition?

Abx
  • 2,852
  • 4
  • 30
  • 50