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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:08:18+00:00 2026-06-04T00:08:18+00:00

The following code work well on ICS and not on 2.3.3. I use a

  • 0

The following code work well on ICS and not on 2.3.3.

I use a custom Toast with a CheckBox and the clickEvents is fired on ICS.

Do I have to create a custom dialog and call it as activity or I can solve it?

public void showToastwithImage(String text, int imageID, boolean forceShow) {

    if (prefs.getBoolean("prefs_showHelp", true)) {
        // create the view
        View view = inflateView(R.layout.message_panel);

        // set the image in the view
        ImageView im = (ImageView) view.findViewById(R.id.panel_icon);
        im.setImageResource(imageID);

        // set the text in the view
        TextView tv = (TextView) view.findViewById(R.id.message);
        tv.setText(text);

        CheckBox cb = (CheckBox) view.findViewById(R.id.checkBox1);

        if(forceShow){
            cb.setVisibility(View.GONE);
        }else{
            cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    SharedPreferences.Editor editor = prefs.edit();
                    editor.putBoolean("prefs_showHelp", false);
                    editor.commit();
                }
            });
        }


        // show the toast
        Toast toast = new Toast(this);
        toast.setView(view);
        toast.setDuration(Toast.LENGTH_LONG);
        toast.show();
    }

}
private View inflateView(int resource) {
    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    return vi.inflate(resource, null);
}
  • 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-04T00:08:19+00:00Added an answer on June 4, 2026 at 12:08 am

    custom dialog is better than toast...

    You can set view easily in custom dialog….and toast is for flash message without interact it.

    Dialog dialog = new Dialog(YourActivityName.this);
    dialog.setContentView(R.layout.dialoglayout);
    
    ImageView im = (ImageView) dialog.findViewById(R.id.panel_icon);
    TextView tv = (TextView) dialog.findViewById(R.id.message);
    CheckBox cb = (CheckBox) dialog.findViewById(R.id.checkBox1);
    
    dialog.show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following code does NOT work, but it expresses well what I wish to do.
Why doesn't following code work correctly in FireFox 3.6? I have tested in IE7,
Why doesn't the following code work? MyViewController *viewController = [[MyViewController alloc] init]; [myWindow addSubview:viewController.view];
How do you make the following code work? example = %%(test)% % {'test':'name',} print
I am trying to add the following code work in a php file but
I am using the following code to work out an inc and ext VAT
I am trying to get the following code to work: if (isset($_POST['file'])){ if(file_exists($_POST['file'])){ echo
following code doesn't work with input: 2 7 add Elly 0888424242 add Elly 0883666666
The following code doesn't work! 'this' in in the context when i access it
The following code seased to work. db.DBUsers.InsertOnSubmit(new DBUser { AllTheStuff = valuesBeyondYourWildestDreams } );

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.