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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:25:22+00:00 2026-06-15T02:25:22+00:00

I am developing an application for Android to provide location within the university using

  • 0

I am developing an application for Android to provide location within the university using the API’s compass, gps and camera.

Could also get some important data based on API’s mentioned above. This is not built-in functionality to Android or Java and requires some algorithm. I need to make a calculation that results in the position (x) that a balloon should appear on the screen as the direction of the mobile user is facing.

To perform the calculation I already have the following data:

  • degrees: direction (degree) in which the cell phone is being directed by the user (obtained by using the compass);
  • grausParaDestino: direction (degree) in that the balloon should be at the center of the screen (with calculations obtained from GPS points);
  • width: width of the screen;

We know that one complete revolution of the user on its axis 360 degrees total.

I tried the calculus below, but is incorrect.

int position = Math.round (((width * grausParaDestino) / 360) + degrees);

I spent yesterday afternoon trying various ways of solving this calculation, but without success. If they can give me some help I appreciate it.

  • 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-15T02:25:23+00:00Added an answer on June 15, 2026 at 2:25 am
    if( grausParaDestino < 0 ){
        grausParaDestino = grausParaDestino + 360;
    }else if( grausParaDestino > 360 ){
        grausParaDestino = grausParaDestino - 360;
    }
    
    Display display = getWindowManager().getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();
    
    if( anlgeOfView < 1 ){
        anlgeOfView = mPreview.getCameraAngleOfView();
    }
    
    int larguraDaTela;
    if( width > height ){
        larguraDaTela = width;
    }else{
        larguraDaTela = height;
    }
    
    double linhaImaginaria = ( larguraDaTela * 360 ) / anlgeOfView;
    
    double posicaoDestinoLinhaImaginaria = ( grausParaDestino * linhaImaginaria ) / 360;
    double posicaoPontoAtualLinhaImaginaria = ( graus * linhaImaginaria ) / 360;
    
    double posicaoBalao = posicaoPontoAtualLinhaImaginaria - posicaoDestinoLinhaImaginaria;
    
    double position = Math.round( ( width / 2 ) - posicaoBalao );
    
    layoutParams layoutParams=new LayoutParams(width, height);
    layoutParams.height = 50;
    layoutParams.width = 50;
    layoutParams.setMargins( (int)position, 50, 0, 0);
    
    ImageView balao = (ImageView)findViewById(R.id.balao);
    balao.setLayoutParams(layoutParams);
    

    With this code i have positioned the balloom on the screem.
    Thanks for all responses.

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

Sidebar

Related Questions

I'm developing a map application in Android. I'm using Google maps API to show
I am developing an Android application that gets your current GPS location but the
I'm developing an android application which deals with capturing location coordinates with GPS. I'm
I i am developing an android application using appcelerator titanium . We can get
I am developing an application using Android SDK. In this application I am facing
i am developing an android application to get a list of class from wevservice
I am developing an app using phonegap for Android. I want this mobile application
I am currently developing an android application and required to get the browser version.
Presently I am developing Android application for Samsung galaxy tab. I am using default
I am developing an application for Android using phonegap. When I include phonegap.js file

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.