Example usage for android.content Intent FLAG_ACTIVITY_NEW_TASK

List of usage examples for android.content Intent FLAG_ACTIVITY_NEW_TASK

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_NEW_TASK.

Prototype

int FLAG_ACTIVITY_NEW_TASK

To view the source code for android.content Intent FLAG_ACTIVITY_NEW_TASK.

Click Source Link

Document

If set, this activity will become the start of a new task on this history stack.

Usage

From source file:org.pixmob.appengine.client.AppEngineClient.java

private String getAuthToken() throws AppEngineAuthenticationException {
    // get an authentication token from the AccountManager:
    // this call is asynchronous, as the user may not respond immediately
    final AccountManagerFuture<Bundle> futureBundle = accountManager.getAuthToken(account, "ah", true, null,
            null);/*from w  w  w .java 2 s  .com*/
    final Bundle authBundle;
    try {
        authBundle = futureBundle.getResult();
    } catch (OperationCanceledException e) {
        throw new AppEngineAuthenticationException(AUTHENTICATION_UNAVAILABLE, e);
    } catch (AuthenticatorException e) {
        throw new AppEngineAuthenticationException(AUTHENTICATION_UNAVAILABLE, e);
    } catch (IOException e) {
        throw new AppEngineAuthenticationException(AUTHENTICATION_UNAVAILABLE, e);
    }

    final String authToken = authBundle.getString(AccountManager.KEY_AUTHTOKEN);
    if (authToken == null) {
        // no authentication token was given: the user should give its
        // permission through an item in the notification bar
        Log.i(TAG, "Authentication permission is required");

        final Intent authPermIntent = (Intent) authBundle.get(AccountManager.KEY_INTENT);
        int flags = authPermIntent.getFlags();
        flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
        authPermIntent.setFlags(flags);

        throw new AppEngineAuthenticationException(AUTHENTICATION_PENDING, authPermIntent);
    }

    return authToken;
}

From source file:net.mypapit.mobile.myrepeater.RepeaterListActivity.java

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.repeater_list);

    overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);

    lv = (ListView) findViewById(R.id.repeaterListView);
    tvAddress = (TextView) findViewById(R.id.tvAddress);

    xlocation = new Repeater("", LAT_DEFAULT, LNG_DEFAULT);

    rl = RepeaterListActivity.loadData(R.raw.repeaterdata5, this);
    xlocation.calcDistanceAll(rl);//from  ww w  .  jav  a  2 s . c  o m
    rl.sort();

    adapter = new RepeaterAdapter(this, rl, xlocation, local_distance, excludeLink, excludeDirection);

    lv.setFastScrollEnabled(true);
    lv.setVerticalFadingEdgeEnabled(false);
    lv.setVerticalScrollBarEnabled(true);
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(this);

    // SharedPreferences prefs = getSharedPreferences("Location",
    // MODE_PRIVATE);
    SharedPreferences prefshare = PreferenceManager.getDefaultSharedPreferences(this);
    int walkcount = prefshare.getInt("walkthrough", WALK_VERSION_CODE);
    if (walkcount < (WALK_VERSION_CODE + 1)) {
        Intent intent = new Intent();

        intent.setClassName(getApplicationContext(), "net.mypapit.mobile.myrepeater.SettingsActivity");
        startActivity(intent);

        intent.setClassName(getApplicationContext(), "net.mypapit.mobile.myrepeater.WalkthroughActivity");
        SharedPreferences.Editor prefEditor = prefshare.edit();
        walkcount++;

        SharedPreferences repeater_prefs = PreferenceManager.getDefaultSharedPreferences(this);

        m_deviceid = repeater_prefs.getString("deviceid", this.generateCallsign());
        prefEditor.putInt("walkthrough", walkcount);
        // prefEditor.putString("callsign", new
        // StringBuilder("9W2-").append(this.generateCallsign()).toString());
        prefEditor.putString("deviceid", m_deviceid);
        prefEditor.commit();

        startActivity(intent);

    }

    // need to put token to avoid app from popping up annoying select manual
    // dialog will be triggered if location/gps is not enabled AND if the
    // date in dd/MM is not equal to 'token' saved in StaticLocationActivity
    // location dialog
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM", Locale.US);
    Date date = new Date();

    SharedPreferences preftoken = getSharedPreferences("Location", MODE_PRIVATE);

    if (!this.isLocationEnabled(this)
            && !dateFormat.format(date).equalsIgnoreCase(preftoken.getString("token", "28/10"))) {

        // show dialog if Location Services is not enabled
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.gps_not_found_title); // GPS not found
        builder.setMessage(R.string.gps_not_found_message); // Want to
        // enable?

        // if yes - bring user to enable Location Service settings
        builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialogInterface, int i) {

                Intent intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

                getApplicationContext().startActivity(intent);
            }
        });

        // if no - bring user to selecting Static Location Activity
        builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                Intent intent = new Intent();
                intent.setClassName(getApplicationContext(),
                        "net.mypapit.mobile.myrepeater.StaticLocationActivity");
                startActivity(intent);

            }

        });
        builder.create().show();

    }

    new GPSThread(this).start();

    lv.setAdapter(adapter);

}

From source file:cm.aptoide.pt.DownloadQueueService.java

private void setFinishedNotification(int apkidHash, String localPath) {

    String apkid = notifications.get(apkidHash).get("apkid");
    int size = Integer.parseInt(notifications.get(apkidHash).get("intSize"));
    String version = notifications.get(apkidHash).get("version");

    RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.download_notification);
    contentView.setImageViewResource(R.id.download_notification_icon, R.drawable.ic_notification);
    contentView.setTextViewText(R.id.download_notification_name,
            getString(R.string.finished_download_message) + " " + apkid + " v." + version);
    contentView.setProgressBar(R.id.download_notification_progress_bar, size * KBYTES_TO_BYTES,
            size * KBYTES_TO_BYTES, false);

    Intent onClick = new Intent("pt.caixamagica.aptoide.INSTALL_APK", Uri.parse("apk:" + apkid));
    onClick.setClassName("cm.aptoide.pt", "cm.aptoide.pt.RemoteInTab");
    onClick.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
    onClick.putExtra("localPath", localPath);
    onClick.putExtra("apkid", apkid);
    onClick.putExtra("apkidHash", apkidHash);
    onClick.putExtra("isUpdate", Boolean.parseBoolean(notifications.get(apkid.hashCode()).get("isUpdate")));
    /*Changed by Rafael Campos*/
    onClick.putExtra("version", notifications.get(apkid.hashCode()).get("version"));
    Log.d("Aptoide-DownloadQueuService",
            "finished notification apkidHash: " + apkidHash + " localPath: " + localPath);

    // The PendingIntent to launch our activity if the user selects this notification
    PendingIntent onClickAction = PendingIntent.getActivity(context, 0, onClick, 0);

    Notification notification = new Notification(R.drawable.ic_notification,
            getString(R.string.finished_download_alrt) + " " + apkid, System.currentTimeMillis());
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.contentView = contentView;

    // Set the info for the notification panel.
    notification.contentIntent = onClickAction;
    //       notification.setLatestEventInfo(this, getText(R.string.app_name), getText(R.string.add_repo_text), contentIntent);

    notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    // Send the notification.
    // We use the position because it is a unique number.  We use it later to cancel.
    notificationManager.notify(apkidHash, notification);

    //      Log.d("Aptoide-DownloadQueueService", "Notification Set");

}

From source file:foundme.uniroma2.it.professore.Connection.java

@Override
protected void onPostExecute(String result[]) {
    if (result[0].equalsIgnoreCase(Variables_it.NO_INTERNET)) {
        if (enProgressDialog)
            caricamento.dismiss();//from   ww w.  ja  va  2  s  . com
        Toast.makeText(context, result[0], Toast.LENGTH_SHORT).show();
        return;
    }
    if (enProgressDialog) {
        caricamento.dismiss();
        if (!returnMessage.equalsIgnoreCase(Variables_it.NAME)
                || result[0].equalsIgnoreCase(Variables_it.ERROR)) {
            if (!returnMessage.equalsIgnoreCase("") && !returnMessage.equalsIgnoreCase(Variables_it.NO_MSG)) {
                Toast.makeText(context, result[0], Toast.LENGTH_SHORT).show();
            }
        }
    }
    if (returnMessage.equalsIgnoreCase(Variables_it.NO_MSG)) {
        ReadMessageActivity.populateView(result);
    } else if (returnMessage.equalsIgnoreCase(Variables_it.DEL_MSG_OK)) {
        try {
            ReadMessageActivity.getMsg(toDo, false);
        } catch (ExecutionException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    } else if (toDo.equalsIgnoreCase(Variables_it.GET)) {
        HomeActivity.populateView(result);
    } else if (returnMessage.equalsIgnoreCase(Variables_it.SEND_MSG_OK)
            && toDo.equalsIgnoreCase(Variables_it.MSGS)) {
        ((Activity) context).finish();
    } else if (returnMessage.equalsIgnoreCase(Variables_it.NAME) && toDo.equalsIgnoreCase(Variables_it.LOG)
            && !result[0].equalsIgnoreCase(Variables_it.ERROR)) {
        SharedPreferences pref = SPEditor.init(context);
        SPEditor.setUser(pref, LoginActivity.getuser());
        SPEditor.setPass(pref, LoginActivity.getpass());
        Intent intent = new Intent(context, HomeActivity.class);
        intent.putExtra(Variables_it.TAG, LoginActivity.gettag());
        intent.putExtra(Variables_it.NAME, result[0]);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        context.startActivity(intent);
    } else if (code == 1 && toDo.equalsIgnoreCase(Variables_it.FINISH)) {
        ((Activity) context).finish();
        try {
            HomeActivity.getCourse(true);
        } catch (ExecutionException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    } else if (code == 1 && toDo.equalsIgnoreCase(Variables_it.CHANGEP)) {
        SharedPreferences pref = SPEditor.init(context);
        SPEditor.setPass(pref, ChangePswActivity.getpass());
        ((Activity) context).finish();
    } else if (code == 1 && toDo.equalsIgnoreCase(Variables_it.REGIS)) {
        SharedPreferences pref = SPEditor.init(context);
        SPEditor.setUser(pref, RegistrationActivity.getmail());
        SPEditor.setPass(pref, RegistrationActivity.getpass());
        ((Activity) context).finish();
    } else if (code == 1 && toDo.equalsIgnoreCase(Variables_it.DELACC)) {
        SharedPreferences pref = SPEditor.init(context);
        SPEditor.delete(pref);
        Intent intent = new Intent(context, LoginActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        context.startActivity(intent);
    }

    else if (code == 1 && toDo.equalsIgnoreCase(Variables_it.HOME)) {
        try {
            HomeActivity.getCourse(false);
        } catch (ExecutionException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.android.idearse.Login.java

public void onBackPressed() {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);//ww  w.j  a  v a2 s  .c  om
}

From source file:samples.piggate.com.piggateCompleteExample.buyOfferActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_credit_card);

    //Set action bar fields
    getSupportActionBar().setTitle(PiggateUser.getEmail());
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    //Views//from  w ww  . j  av  a  2s .  com
    EditCardNumber = (EditText) findViewById(R.id.cardNumber);
    EditCVC = (EditText) findViewById(R.id.CVC);
    SpinnerYear = (Spinner) findViewById(R.id.spinerYear);
    SpinnerMonth = (Spinner) findViewById(R.id.spinerMonth);
    validate = (Button) findViewById(R.id.buttonValidate);
    buttonBuy = (Button) findViewById(R.id.buttonBuy);
    buttonCancel = (Button) findViewById(R.id.buttonCancel);
    headerLayout = (LinearLayout) findViewById(R.id.headerLayout);
    cardlayout = (LinearLayout) findViewById(R.id.cardlayout);
    buylayout = (LinearLayout) findViewById(R.id.buyLayout);
    image = (SmartImageView) findViewById(R.id.offerImage2);

    //Animations
    slidetoLeft = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidetoleft);
    slidetoRight = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidetoright);
    slidefromRight = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidefromright);
    slidefromLeft = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidefromleft);

    //Validation Error AlertDialog
    errorDialog = new AlertDialog.Builder(buyOfferActivity.this).create();
    errorDialog.setTitle("Validation error");
    errorDialog.setMessage("The credit card is not valid");
    errorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    //Network Error AlertDialog
    networkDialog = new AlertDialog.Builder(this).create();
    networkDialog.setTitle("Network error");
    networkDialog.setMessage("Network is not working");
    networkDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    image.setImageUrl(getIntent().getExtras().getString("offerImgURL")); //Set the offer image from URL
    //(Provisional) set the default fields of the credit card
    EditCardNumber.setText("4242424242424242");
    EditCVC.setText("123");

    piggate = new Piggate(this); //Initialize Piggate Object

    //OnClick listener for the validate button
    validate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            //Validate the credit card with Stripe
            if (checkInternetConnection() == true) {
                // Credit card for testing: ("4242-4242-4242-4242", 12, 2016, "123")
                if (piggate.validateCard(EditCardNumber.getText().toString(),
                        Integer.parseInt(SpinnerMonth.getSelectedItem().toString()),
                        Integer.parseInt(SpinnerYear.getSelectedItem().toString()),
                        EditCVC.getText().toString(), "pk_test_BN86VnxiMBHkZtzPmpykc56g", //Stripe test. Will be returned by requests in next release
                        buyOfferActivity.this, "Validating", "Wait while the credit card is validated")) {
                    openBuyLayout();
                } else
                    errorDialog.show();
            } else {
                networkDialog.show();
            }
        }
    });

    //OnClick listener for the buy button
    buttonBuy.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            //Do the buy request to the server
            RequestParams params = new RequestParams();
            //Get the latest credit card Stripe token, amount to pay, type of coin and ID
            params.put("stripeToken", piggate.get_creditCards().get(piggate.get_creditCards().size() - 1)
                    .getTokenID().toString());
            params.put("amount", getIntent().getExtras().getString("offerPrice"));
            params.put("offerID", getIntent().getExtras().getString("offerID"));
            params.put("currency", getIntent().getExtras().getString("offerCurrency"));

            //Loading payment ProgressDialog
            loadingDialog = ProgressDialog.show(v.getContext(), "Payment", "Wait while the payment is finished",
                    true);

            //Do the buy request to the server (The server do the payment with Stripe)
            piggate.RequestBuy(params).setListenerRequest(new Piggate.PiggateCallBack() {

                //onComplete method for JSONObject
                @Override
                public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                    loadingDialog.dismiss();

                    //Go back to the offer list passing the offer attributes (to exchange)
                    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
                    slideactivity.putExtra("offerID", getIntent().getExtras().getString("offerID"));
                    slideactivity.putExtra("offerName", getIntent().getExtras().getString("offerName"));
                    slideactivity.putExtra("offerDescription",
                            getIntent().getExtras().getString("offerDescription"));
                    slideactivity.putExtra("payment", true);
                    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(),
                            R.anim.slidefromleft, R.anim.slidetoright).toBundle();
                    startActivity(slideactivity, bndlanimation);
                }

                //onError method for JSONObject
                @Override
                public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {

                    //Show an error and go back to the credit card
                    loadingDialog.dismiss();
                    //Go back to the offer list with the variable payment set to false (payment error)
                    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
                    slideactivity.putExtra("payment", false);
                    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(),
                            R.anim.slidefromleft, R.anim.slidetoright).toBundle();
                    startActivity(slideactivity, bndlanimation);
                }

                //onComplete method for JSONArray
                @Override
                public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                    loadingDialog.dismiss();

                    //Go back to the offer list passing the offer attributes (to exchange)
                    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
                    slideactivity.putExtra("offerID", getIntent().getExtras().getString("offerID"));
                    slideactivity.putExtra("offerName", getIntent().getExtras().getString("offerName"));
                    slideactivity.putExtra("offerDescription",
                            getIntent().getExtras().getString("offerDescription"));
                    slideactivity.putExtra("payment", true);
                    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(),
                            R.anim.slidefromleft, R.anim.slidetoright).toBundle();
                    startActivity(slideactivity, bndlanimation);
                }

                //onError method for JSONArray (Show an error and go back to the credit card)
                @Override
                public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {

                    //Show an error and go back to the credit card
                    loadingDialog.dismiss();
                    //Go back to the offer list with the variable payment set to false (payment error)
                    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
                    slideactivity.putExtra("payment", false);
                    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(),
                            R.anim.slidefromleft, R.anim.slidetoright).toBundle();
                    startActivity(slideactivity, bndlanimation);
                }
            }).exec();
        }
    });

    //OnClick listener for the cancel button (Go back to the credit card)
    buttonCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            closeBuyLayout();
        }
    });
}

From source file:com.mobiperf.speedometer.AccountSelector.java

private void getAuthToken(AccountManagerFuture<Bundle> result) {
    Logger.i("getAuthToken() called, result " + result);
    String errMsg = "Failed to get login cookie. ";
    Bundle bundle;/*from  w  w  w .ja v a  2  s.  c  om*/
    try {
        bundle = result.getResult();
        Intent intent = (Intent) bundle.get(AccountManager.KEY_INTENT);
        if (intent != null) {
            // User input required. (A UI will pop up for user's consent to
            // allow
            // this app access account information.)
            Logger.i("Starting account manager activity");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        } else {
            Logger.i("Executing getCookie task");
            synchronized (this) {
                this.authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN);
                this.checkinFuture = checkinExecutor.submit(new GetCookieTask());
            }
        }
    } catch (OperationCanceledException e) {
        Logger.e(errMsg, e);
        throw new RuntimeException("Can't get login cookie", e);
    } catch (AuthenticatorException e) {
        Logger.e(errMsg, e);
        throw new RuntimeException("Can't get login cookie", e);
    } catch (IOException e) {
        Logger.e(errMsg, e);
        throw new RuntimeException("Can't get login cookie", e);
    }
}

From source file:com.onesignal.GenerateNotification.java

private static Intent getNewBaseDeleteIntent(int notificationId) {
    Intent intent = new Intent(currentContext, notificationOpenedClass)
            .putExtra("notificationId", notificationId).putExtra("dismissed", true);

    if (openerIsBroadcast)
        return intent;
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK
            | Intent.FLAG_ACTIVITY_NO_ANIMATION);
}

From source file:org.wso2.app.catalog.api.ApplicationManager.java

/**
 * Installs an application to the device.
 *
 * @param fileUri - File URI should be passed in as a String.
 *//*  www  .  j a  v a 2  s  . co  m*/
public void startInstallerIntent(Uri fileUri) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(fileUri, resources.getString(R.string.application_mgr_mime));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:org.youaretheone.website.client.UoneSearchGsonActivity.java

private void checkTab() {
    if (mMenuPanel != null) {
        if (mMenuPanel.getVisibility() == View.VISIBLE) {
            toggleMenu();// w ww  .j a va2  s . co m
        }
        switch (mTabHost.getCurrentTab()) {
        case TabItem.SEARCH:
            content.setText(getString(R.string.search));
            (new UoneSearchTask()).execute();
            break;
        case TabItem.SHARE:
            content.setText(getString(R.string.share));
            (new UoneSearchTask()).execute();
            break;
        case TabItem.WEBSITE:
            content.setText(getString(R.string.website));
            final Intent visit = new Intent(Intent.ACTION_VIEW);
            visit.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            visit.setData(android.net.Uri.parse(WEBSITE));

            // Use a thread so that the menu is responsive when
            // clicked
            new Thread(new Runnable() {
                public void run() {
                    startActivity(visit);
                }
            }).start();
            break;
        case TabItem.SETTINGS:
            content.setText(getString(R.string.settings));
            (new UoneSearchTask()).execute();
            break;
        case TabItem.QUIT:
            content.setText(getString(R.string.quit));
            new Thread(new Runnable() {
                public void run() {
                    UoneSearchGsonActivity.this.finish();

                    // The following makes the Android Gods frown
                    // upon me
                    android.os.Process.killProcess(android.os.Process.myPid());
                    System.exit(0);
                }
            }).start();
            break;
        default:
            break;
        }

        // Handle click on currently selected tab - hide menu bar
        // IMPORTANT: This listener has to appear AFTER the tabs are
        // added
        // Unfortunately, This doesn't work when the current tab
        // contains an activity (except for tab 0)
        // If you only have method tabs then it works perfect
        mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab())
                .setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        toggleMenu();
                    }
                });

        // if you want to reset the current tab
        // mTabHost.setCurrentTab(0);
    }

}