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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:29:13+00:00 2026-05-27T19:29:13+00:00

I have a button i need two action to be taken place ,that is

  • 0

I have a button i need two action to be taken place ,that is when i open my app for the first time after installation it should preform a task .after the first launch it did not want to perform the first action how can i implement this?

I implement this,

private int _clicks = 0;
k = (Button)findViewById(R.id.button1);


    if(count == 1)
         //do whatever
    if(count == 2)
         //do whatever
    if(count == 3)
         //do whatever
}
});
  • 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-27T19:29:14+00:00Added an answer on May 27, 2026 at 7:29 pm

    You have to remember that you have performed the task already. So I suggest you store a value in the SharedPreferences Which you set after performing the task and recheck before handling any other click in the future.

    SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE);
    
    if(!prefs.getBoolean("WAS_INITIALIZED", false)){
        // will only be executed after the first run. 
        // remember that it was initialized
        Editor editor = prefs.edit();
        editor.putBoolean("WAS_INITIALIZED", true);
    
        // put you code which should only be run once here ..
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button that loads two different pages in two iframes. I need
OK, I have two HTML select elements and a button. I need to disable
I have a Button on appwidget, that I need to 'enable'/'disable' programmatically from a
I need a button-like control that can have a Checked property, so that when
I have a hidden button on a form that I need to click in
i have a form button in the form,which i need to perform basic action
I have a view that has two buttons(First and Second) and one hidden field.
So, I'm developing an app and need to have two buttons pressed at the
I have two textfields and two buttons and the button should not be visible
I have two UIViewControllers.In the firstViewController,there is a button ,the button action is SecondViewController

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.