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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:26:32+00:00 2026-05-27T04:26:32+00:00

In my application I want to fill the sliding draw only when data is

  • 0

In my application I want to fill the sliding draw only when data is not null.
So , when the user presses on the sliding drawer handler it should give a dialog “Data is empty” and sliding drawer should not open.

I have tried Handler.setOnTouchListener() but what happens is anywhere a touch event is called that dialog box appear.

Any suggestions?

  • 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-05-27T04:26:32+00:00Added an answer on May 27, 2026 at 4:26 am

    You should take a look at the method setOnDrawerOpenListener.

    Create your own OnDrawerOpenListener and use it to check if the data is null – if it is, close the drawer again:

    private class OnDrawerOpened implements OnDrawerOpenListener {
      @Override
      public void onDrawerOpened() {
        if( data == null )
          mySlidingDrawer.close();
      }
    }
    

    You would need a reference to your SlidingDrawer and you would need OnDrawerOpened to be an inner class, so you can access the reference to your SlidingDrawer.

    Alternative

    You could also create your own subclass by extending SlidingDrawer and then override the animateOpen() and open() methods (you might need to override animateToggle() and toggle() too):

    public class MySlidingDrawer extends SlidingDrawer {
    
      public MySlidingDrawer( Context context, AttributeSet attrs ) {
        super( context, attrs );
      }
    
      @Override
      public void animateOpen() {
        if( data != null )    
          super.animateOpen();
        else
          //Show dialog
      }
    
      @Override
      public void open() {
        if( data != null )
          super.open();
        else
          //Show dialog
      }
    }
    

    If you do this, you would need to reference your own implementation of the SlidingDrawer in your XML:

    <com.myPackage.MySlidingDrawer>
       ...
    </com.myPackage.MySlidingDrawer>
    

    Depeding on how and when you get the data to check for null, you might want to either pass it to MySlidingDrawer in its constructor or add a method through which you can set the data.

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

Sidebar

Related Questions

In my application I want to present a list of choices for a user
I want to fill the color in white area for Paint based application so
i want to fill the data of the charts from values i have in
Hey guys, I have an application that I want to display some data from
So let's say I have an MVVM application and I want the user to
I want to fill a dataGrid in my WPF application. My XAML: <DataGrid AutoGenerateColumns=True
I have a Tabbar - Application and i want to show data (NSString) from
I want to implement the search option for my application,and auto fill option for
I want my application to fill in a single field in a form that
I have a WTL C++ application and I want the user to be able

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.