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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:41:12+00:00 2026-06-12T00:41:12+00:00

Iam working on an android app and using AChartEngine for charting. Everything is working

  • 0

Iam working on an android app and using AChartEngine for charting. Everything is working as it should except that I capture the coordinates of touch on screen in OnTouch() method. On first touch it doesnt return me any coordinates and Toast is displayed on Top Left Corner (set by Toast.setGravity()). On Subsequent touches it works perfectly fine and just not on first time i click or touch the screen. Where am i Wrong?

mChartView.setOnClickListener(new View.OnClickListener() {
             Toast test;
            public void onClick(View v) {
              SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
              v.setOnTouchListener(new OnTouchListener() {
               public boolean onTouch(View v, MotionEvent event) {

                      xaxis =  event.getX();
                      yaxis =  event.getY(); 
                      xx = (int) xaxis;
                    yy = (int) yaxis;
            return false;
                    }
                });


              if (seriesSelection != null) {

                  int status_index = seriesSelection.getSeriesIndex();
                  int equipment_index = seriesSelection.getPointIndex();
                  double duration_value = seriesSelection.getValue();

                  if(status_index == 0)
                  {
                      if(equipment_index == 0)
                      {
                          duration_value = EquipmentHoursDuration[0][1];
                      }
                      if(equipment_index == 1)
                      {
                          duration_value = EquipmentHoursDuration[1][1];
                      }
                      if(equipment_index == 2)
                      {
                          duration_value = EquipmentHoursDuration[2][1];
                      }
                      if(equipment_index == 3)
                      {
                          duration_value = EquipmentHoursDuration[3][1];
                      }
                      if(equipment_index == 4)
                      {
                          duration_value = EquipmentHoursDuration[4][1];
                      }
                      String final_status = titles[status_index];
               String final_equipment = EquipmentNamePartial[equipment_index];
                    test = Toast.makeText(
                            SalesBar.this,
                              "Status: " + final_status + '\n'
                            + " Equipment: " + final_equipment + '\n'
                            + " Duration: " + duration_value + " hours", Toast.LENGTH_SHORT);


                   test.setGravity(Gravity.TOP|Gravity.LEFT, xx, yy);

                      test.show();
                  }

                  else
                  {
                 String final_status = titles[status_index];
                 String final_equipment = EquipmentNamePartial[equipment_index];
                 if(equipment_index == 0)
              {
                  duration_value = EquipmentHoursDuration[0][0];
              }
              if(equipment_index == 1)
              {
                  duration_value = EquipmentHoursDuration[1][0];
              }
              if(equipment_index == 2)
              {
                  duration_value = EquipmentHoursDuration[2][0];
              }
              if(equipment_index == 3)
              {
                  duration_value = EquipmentHoursDuration[3][0];
              }
              if(equipment_index == 4)
              {
                  duration_value = EquipmentHoursDuration[4][0];
              }



                test = Toast.makeText(
                        SalesBar.this,
                          "Status: " + final_status + '\n'
                        + " Equipment: " + final_equipment + '\n'
                        + " Duration: " + duration_value + " hours", Toast.LENGTH_SHORT);

                     test.setGravity(Gravity.TOP|Gravity.LEFT, xx, yy);

                      test.show();
                  }
              }
            }
          });
  • 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-12T00:41:13+00:00Added an answer on June 12, 2026 at 12:41 am

    When you call the 1st onClickListener, there is only called the 1st touch. After that the onClickListener will be called as usually.
    Probably you can try to swap the onClickListener to onTouchListener.

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

Sidebar

Related Questions

Button Click of my Android App using Sencha Touch 2 is working fine in
I am working on an app for android using phonegap and unity. I wrote
I am working with Amazon In-app-purchases for Android on flash using native extentions. So,
I am working on an Android app that utilizes the Google Maps API MapView,
I am working on an android app that has a database in which one
I am working on an Android app that uses the gdata-java-client to download documents
I am working on an Android app that has multiple screens the user will
I am working on an android app in which I am using some Native
I am developing an Android app using Phonegap and jQueryMobile, working in Eclipse. I
I am working on an android app that has two activities. One is the

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.