Last active
November 25, 2015 14:37
-
-
Save devrath/4f9b254c345be0b93c2b to your computer and use it in GitHub Desktop.
Dynamic plotPoints send to server and RePlot it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Use this code to get Device's height and width and save them to variable, like this | |
| DisplayMetrics displaymetrics = new DisplayMetrics(); | |
| getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); | |
| int height = displaymetrics.heightPixels; | |
| int width = displaymetrics.widthPixels; | |
| //After getting your X and Y use below mentioned function to get percentage | |
| int percentageX= (int)((x*100)/width) | |
| int percentageY= (int)((y*100)/height) | |
| //Save these as coordinates in server | |
| //Now before you reuse the plot points from server. Convert them back to Pixels using | |
| int newX = (int)((x*width)/100) | |
| int newy = (int)((y*height)/100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment