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

  • Home
  • SEARCH
  • 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 9225175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:30:47+00:00 2026-06-18T04:30:47+00:00

I have an activity in which I have an ImageView and a SeekBar. I

  • 0

I have an activity in which I have an ImageView and a SeekBar. I registered a listener with imageview1.setOnTouchListener(mylistener) for the ImageView(mylistner is a class). I get the motion events in onTouch method in my listener. I want the program to hide the SeekBar when I touch the Image View. All the Tutorials I watched show how the listener gets the event from the source. But what I am looking for is sending the data back to the source, so that it can hide the SeekBar.

The main question is in touch event handling of an activity how we can get results back from the listener class to the calling class(source)? Is there a better way to do what I want?

should I make another event which will call for the SeekBar? if yes How?

public class A extends Activity {
//.....
final SeekBar sb=(SeekBar) findViewById(R.id.seekBar1);
Mylistener mylistener;
mylisetner=new MyListener(getApplicationContext());

ImageView.setOnTouchListener(mylistener);
//.....

}

public class MyListener implements View.OnTouchListener {
//.....

public boolean onTouch(View v, MotionEvent event) {
final int action = event.getAction() & MotionEvent.ACTION_MASK; 
switch (action) {
        case MotionEvent.ACTION_DOWN:          
       // here how can you get access to the seek bar? or how you inform it to hide?
}
//....

}
  • 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-18T04:30:48+00:00Added an answer on June 18, 2026 at 4:30 am

    From what i understood from your question, you want to hide the seekbar when imageview is touched.. right?

    try following code in your ontouchlistener….

    public boolean onTouch(View v, MotionEvent event) {  
     if (event.getAction() == MotionEvent.ACTION_UP){
         seekbar.setVisibility(View.VISIBLE);
     } else if (event.getAction() == MotionEvent.ACTION_DOWN) {
         seekbar.setVisibility(View.GONE);
     }
    }
    

    where seekbar is your SEEKBAR :), hold its reference in oncreate…..

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

Sidebar

Related Questions

I have this method inside an Activity which implements an ImageLoader class: public void
I have an Activity with an ImageView, which, if it is empty and clicked,
I have an activity which has an ImageView in it. What I want to
I have an activity which contains 2 textviews and an imageview. First textview contains
Somehow I don't seem to get it. 8-} I have an activity in which
I have an Activity which loads a custom ImageView ( https://github.com/MikeOrtiz/TouchImageView/blob/master/src/com/example/touch/TouchImageView.java ). Inside onCreate,
I’m new to android,I have an activity class which fetches Json string from url
I have a activity where I have two imageViews. In onTouch I recognize which
I have an activity which is going to switch around between several views, and
I have a activity which has a button and 2 autocomplete widget. for 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.