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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:11:32+00:00 2026-05-25T20:11:32+00:00

I am a beginner of android development. Current, I am working on creating a

  • 0

I am a beginner of android development. Current, I am working on creating a small home screen widget that is changing wallpaper of the mobile on click the button. The setting wallpaper is working fine but I want to make a clickable small picture (ImageView) to allow user to show and hide this setting button.

I setup it on service and use PendingIntent in order to attach my onClick event to the same service, but I cannot detect the property of button whether showing or hiding.

Therefore,is there any suggestion and solution to make my ImageView to show or hide the button in home screen widget?

Thanks in advance..

  • 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-25T20:11:33+00:00Added an answer on May 25, 2026 at 8:11 pm

    You can use mButton.setVisibility(View.GONE) to hide the button.

    You can also check state of button’s visibility in a boolean variable using mButton.isShown().

    Edited:

    For Example

    In onReceive() of AppWidgetProvider,

         remoteViews = new RemoteViews( context.getPackageName(), R.layout.yourwidgetlayout );
    
         remoteViews.setViewVisibility(viewId, visibility);
    

    So for hiding your Button

         remoteViews.setViewVisibility(R.id.buttonId,View.INVISIBLE);
    

    Edit – 2: According to Kartik’s comment,

    Sample Code:

        public class ButtonHideShowWidget extends AppWidgetProvider {
    
         private static boolean status = false;
    
         @Override
         public void onReceive(Context context, Intent intent) {
          super.onReceive(context, intent);
          if (intent.getAction()==null) {
    
                 Bundle extras = intent.getExtras();
                 if(extras!=null) {
    
                     remoteViews = new RemoteViews( context.getPackageName(), R.layout.your_widget_layout );
                     if(status){
                       remoteViews.setViewVisibility(R.id.buttonId,View.INVISIBLE);
                      status = false;
                     }else{
                       remoteViews.setViewVisibility(R.id.buttonId,View.VISIBLE);
                      status = true;
                  }
    
                     watchWidget = new ComponentName( context, ButtonHideShowWidget.class );
    
                     (AppWidgetManager.getInstance(context)).updateAppWidget( watchWidget, remoteViews );
                     //Toast.makeText(context, "Clicked "+status, 2000).show();
                 }
             }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am beginner in Android app development i am working on a app which
im really out of idea and im just a beginner in android development, how
i am beginner in android development. How to send images among the different android
I am beginner in android application development. If i am using n number of
I'm a beginner in Android development but not in programming itself. Anyway, this question
I'm a beginner for Android Development. So, i have need to deploy my Android
I started learning some Android development with a beginner's book I bought recently. The
I'm a beginner in android, I'm practicing a Project that have a 2 labels
I am a beginner with android development, and I was wondering if it is
I am beginner in the android development, can any one tell me how to

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.