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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:51:38+00:00 2026-05-24T07:51:38+00:00

I am just a themer, not a programmer, any help/guidance is appreciated. I am

  • 0

I am just a themer, not a programmer, any help/guidance is appreciated.
I am trying to add a Cancel button to this code:

public class gobuuf extends Activity {
/** Called when the activity is first created. */

class CustomAlertDialog extends AlertDialog {
    public CustomAlertDialog(Context context) {
        super(context);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        boolean ret = super.onKeyDown(keyCode, event);
        finish();
        return ret;
    }

    public void setCancel(int buttonNegative, String string, Object object) {
        // TODO Auto-generated method stub

    }
}

private CustomAlertDialog mDialog;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    if (isExistSkin("com.gau.go.launcherex")) {
        startGOLauncher("com.gau.go.launcherex");
        finish();
        return;
    }

    mDialog = new CustomAlertDialog(this);
    mDialog.setTitle(R.string.dialogtitle);
    mDialog.setMessage(getResources().getString(R.string.dialogcontent));
    mDialog.setCancel(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.dialognothanks), null);
    mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.dialogok),
            new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String marketuriString = "market://search?q=pname:com.gau.go.launcherex";
            Intent EMarketintent = new Intent(Intent.ACTION_VIEW, Uri.parse(marketuriString));
            EMarketintent.setPackage("com.android.vending");
            EMarketintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//              Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(marketuriString));     
            try {
                startActivity(EMarketintent);
            } catch (ActivityNotFoundException e) {
                String link = "http://61.145.124.93/soft/3GHeart/com.gau.go.launcherex.apk";
                Uri browserUri = Uri.parse(link);
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, browserUri);
                browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                try {
                    startActivity(browserIntent);
                } catch (ActivityNotFoundException e2) {
                    // TODO: handle exception
                    e2.printStackTrace();
                }
            } catch (Exception e3) {
                // TODO: handle exception
                e3.printStackTrace();
            }
            finish();

        }
    });
    mDialog.show();
}


@Override
protected void onDestroy() {
    super.onDestroy();
    android.os.Process.killProcess(android.os.Process.myPid());
}

private boolean isExistSkin(String packageName) {
    try {
            createPackageContext(packageName,
                    Context.CONTEXT_IGNORE_SECURITY);
        } catch (NameNotFoundException e) {
            return false;
        }
    return true;
}

private void startGOLauncher(String packageName){
    PackageManager packageMgr = this.getPackageManager();
    Intent launchIntent = packageMgr.getLaunchIntentForPackage(packageName);
    if (null != launchIntent){
        try
        {
            this.startActivity(launchIntent);
        }
        catch(ActivityNotFoundException e)
        {

        }
    }
}
}

I have added the corresponding string, but don’t know what else to do: add an onclicklistener, I know I need some kind of action coded somewhere finish(); or .cancel something. Thanks for any help, again.

I should say, I’ve been playing around with this bit you see:

mDialog.setCancel(DialogInterface.BUTTON_NEGATIVE,getResources().getString(R.string.dialognothanks), 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-05-24T07:51:39+00:00Added an answer on May 24, 2026 at 7:51 am

    It’s now working and performing how I wanted it to by doing this:

    1) I removed:

    public void setCancel(int buttonNegative, String string, Object object) {
        // TODO Auto-generated method stub
    }
    

    and

    mDialog.setCancel(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.dialognothanks), null);
    

    2) and added:

    mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.dialognothanks),
                new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                                    mDialog.cancel();
                                            finish();
                                    }
                            });
    

    just before the

     mDialog.show();
    

    Trial and Error FTW. Maybe I should learn Java and Android from the ground up to save me the time later.

    Now I have to learn how to make the Cancel button not only finish(); but also start another activity.

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

Sidebar

Related Questions

I just finish reading delphi-skinning-libraries and sptbxtoolbar-skin-change but this is not what I wanted.
Ok I have a form inside a shadowbox, this thing will just not validate...
I was just wondering if anyone had any experience with more customized/specified theme rolling?
I've been having this bothering recurring theme; let's just say, I have a class
Just learning the world of jquery, and all my googling gives examples like this:
This may be something I just have to live with, but does the blockUI
I'm trying to make just a few minor tweaks to the default template of
I'm not a fan of PHP or spaghetti code, or anything like that, but
When I run this code the alert dialog is shown but there is one
I am getting this warning when I switch views (which are just different themes)

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.