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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:54:20+00:00 2026-06-09T01:54:20+00:00

I develop an Augmented Reality application which display markers on a camera view. The

  • 0

I develop an Augmented Reality application which display markers on a camera view.
The markers are views dynamically created by getting positions in a database. A marker represents a building for example, described by a name and a position (latitude / longitude).

When the application is launched, I get the current location of the phone and display the markers on the screen according to their locations and the orientation of the phone (SensorManager).

The problem is that when markers are in the same direction, they are overlapped. I would like that the markers are arranged one over one.

I tried using a RelativeLayout but it doesn’t change anything.

Code for markers Creation :

@Override
public void onResume() {
    super.onResume();


        for(int j=0;j<markers.length;j++) {
            //System.out.println(prefMarkers[j]);
            if(markers[j] == null) {

                RelativeLayout.LayoutParams rParams = new RelativeLayout.LayoutParams(
                        RelativeLayout.LayoutParams.WRAP_CONTENT,
                        RelativeLayout.LayoutParams.WRAP_CONTENT);

                    markers = new DataList(); // My list of markers
                    for(int i=0; i<markers.size();i++) {
                        markers[i].setOnClickListener(clickListener);
                            //addContentView(markers[j].get(i), params);
                            relative.addView(markers[j].get(i), rParams);
                    }
                }
            }}}

Code when the location change (the markers move) :

public final static void moveSpot(Context c, View tv, GeoPoint p,
        float azimut, Location me, int screenWidth, float roll,
        int screenHeight, float pitch) {
    int angle = // Calculation for the position of the markers
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
            FrameLayout.LayoutParams.WRAP_CONTENT,
            FrameLayout.LayoutParams.WRAP_CONTENT);

            lp.leftMargin = -angle * screenWidth / 90;

    lp.addRule(RelativeLayout.ABOVE);

    tv.setLayoutParams(lp);
}

public SensorEventListener createListener() {
    return new SensorEventListener() {
        public void onAccuracyChanged(Sensor _sensor, int _accuracy) {

        }

        public void onSensorChanged(SensorEvent evt) {
            if (evt.sensor.getType() == Sensor.TYPE_ORIENTATION && markers != null) {

                for(int j=0;j<markers.length;j++)
                    moveSpot(context, markers[i], markers[i]
                                    .getGeoPoint(), azimut, myLoc,
                                    mScreenWidth, roll, mScreenHeight, pitch);

        }
    };
}

I think I don’t take the right way so how can I do to prevent the overlapping of the markers ?
If you need precisions, ask and I’ll try to be as precise as possible.

And sorry for my bad english :/


EDIT : Thanks to Martin Revert’s response, I solved a part of my problem. Now I don’t have problem of overlapping, but of position.

Here a screenshot of my application now :

http://hpics.li/f7c402b

On this picture, we can see there is no problem of overlapping anyway.
That I would like to do is in this remake of the screenshot :

http://hpics.li/25a059d

I hope I’m clear this time 😡

  • 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-09T01:54:22+00:00Added an answer on June 9, 2026 at 1:54 am

    You need to assign an id to every View you create on your ViewGroup.

    If every marker is a View use something like:

    yourview[j].setId(j);
    

    Do this before you apply your addRule() onto your “lp” layout.

    EDIT:

    You may also consider to take reference of every view position doing something like this:

    lp.addRule(RelativeLayout.ABOVE, yourview[j-1]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ARToolKit to develop an iOS augmented reality application based on the detection
i develop an java desktop application which consome sqlite database. (My pc, windows 7
I develop one book reader application which play audio according to page, but problem
I develop a Java application with 4 tiers : database (MySQL), persistence (JPA), business
I'm planning to start an application comprises of augmented reality in android. Proposed application
I develop application in Java and Spring AOP. Anything is good, but I've created
I develop an application which has several tasks like report generator, show history etc,
I develop a application and in which i have a Menu option which i
I am planning to develop augmented reality on android platform.Flash 4.5 SDK now enables
We develop Win32 application that access to SQL 2005 database through Linq to SQL.

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.