Example usage for android.content Intent FLAG_ACTIVITY_CLEAR_TOP

List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_TOP

Introduction

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

Prototype

int FLAG_ACTIVITY_CLEAR_TOP

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

Click Source Link

Document

If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent.

Usage

From source file:co.beem.project.beem.ui.wizard.AccountConfigureFragment.java

/**
 * Callback called when the account was connected successfully.
 *
 * @param jid the jid used to connect/*from www . ja v a 2s. c o  m*/
 * @param password the password used to connect
 *
 */
private void onAccountConnectionSuccess(String jid, String password) {
    Activity a = getActivity();
    saveCredential(jid, password);
    // launch login
    Intent i = new Intent(a, Login.class);
    i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(i);
    a.finish();
}

From source file:com.netpace.expressit.activity.UploadVideoStoryActivity.java

private void publishMediaOnRemoteServer() {

    dialog.setMessage("Publishing on XIT...");

    Media media = new Media();
    media.setMediaShortURL(fileKey);// ww  w  . ja  va 2s . com
    media.setMediaName(fileKey + "." + FileUtils.getFileExtension(video_filePath));
    media.setMediaCaption(titleTextView.getText().toString());
    media.setMediaType(MediaTypeEnum.VIDEO);

    Meta meta = new Meta();
    meta.setThumb(fileKey + "-thumb." + FileUtils.getFileExtension(thumb_filePath));
    media.setMeta(meta);

    ADMediaSharingUtil.getRestClient(UploadVideoStoryActivity.this)
            .load(AppConstants.DOMAIN_URL + AppConstants.PUBLISH_MEDIA_URL).setJsonObjectBody(media).asString()
            .withResponse().setCallback(new FutureCallback<Response<String>>() {

                @Override
                public void onCompleted(Exception e, Response<String> result) {
                    if (dialog.isShowing())
                        dialog.dismiss();
                    if (e == null && result.getHeaders().getResponseCode() == HttpStatus.SC_OK) {
                        Toast.makeText(UploadVideoStoryActivity.this, "Uploaded Successfully",
                                Toast.LENGTH_SHORT).show();
                        Intent intent = new Intent(UploadVideoStoryActivity.this, SlideMenuActivity.class);
                        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        startActivity(intent);
                    } else {
                        Toast.makeText(UploadVideoStoryActivity.this, e.getLocalizedMessage(),
                                Toast.LENGTH_SHORT).show();
                    }
                }
            });
}

From source file:com.towson.wavyleaf.Sighting.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        Intent mainIntent = new Intent(this, Main.class);
        mainIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(mainIntent);//  w  w w.j a  v  a 2  s .  c  o m
        finish();
        return true;
    case R.id.menu_submit:
        //           Toast.makeText(getApplicationContext(), String.valueOf(currentEditableLocation.getTime()), Toast.LENGTH_SHORT).show();
        if (isAccurateLocation(currentEditableLocation)) {//if LocationListener is accurate
            // If all fields are filled out, minus Notes/Area infested
            if (verifyFields() == true) {
                Toast.makeText(getApplicationContext(), "Sighting recorded", Toast.LENGTH_SHORT).show();
                createJSONObject();
                finish();
            }
        } else if (requestUpdatesFromProvider() == null) // If no GPS
            Toast.makeText(getApplicationContext(), "Cannot submit without GPS signal", Toast.LENGTH_SHORT)
                    .show();
        else {
            // If all fields are filled out, minus Notes/Area infested
            if (verifyFields() == true) {
                Toast.makeText(getApplicationContext(), "Sighting recorded", Toast.LENGTH_SHORT).show();
                createJSONObject();
                // Restore preferences
                SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
                boolean tripEnabled = sp.getBoolean("TRIP_ENABLED", false);
                if (!tripEnabled) {
                    locationData.stop();
                }
                updateLocationTimer.cancel();
                finish();
            }
        }
        return true;
    case R.id.menu_refresh:
        mMap.clear();
        mapHasMarker = false;
        refresh();
        Toast.makeText(getApplicationContext(), "Location refreshed", Toast.LENGTH_SHORT).show();
        return true;
    case R.id.menu_legal:
        showDialog(LEGAL);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.android.contacts.ShortcutIntentBuilder.java

private void createPhoneNumberShortcutIntent(Uri uri, String displayName, String lookupKey, byte[] bitmapData,
        String phoneNumber, int phoneType, String phoneLabel, String shortcutAction) {
    final Drawable drawable = getPhotoDrawable(bitmapData, displayName, lookupKey);
    final Bitmap icon;
    final Uri phoneUri;
    final String shortcutName;
    if (TextUtils.isEmpty(displayName)) {
        displayName = mContext.getResources().getString(R.string.missing_name);
    }/*from   w  w  w . j  a v a2s .  c o m*/

    if (Intent.ACTION_CALL.equals(shortcutAction)) {
        // Make the URI a direct tel: URI so that it will always continue to work
        phoneUri = Uri.fromParts(PhoneAccount.SCHEME_TEL, phoneNumber, null);
        icon = generatePhoneNumberIcon(drawable, phoneType, phoneLabel,
                R.drawable.quantum_ic_phone_vd_theme_24);
        shortcutName = mContext.getResources().getString(R.string.call_by_shortcut, displayName);
    } else {
        phoneUri = Uri.fromParts(ContactsUtils.SCHEME_SMSTO, phoneNumber, null);
        icon = generatePhoneNumberIcon(drawable, phoneType, phoneLabel,
                R.drawable.quantum_ic_message_vd_theme_24);
        shortcutName = mContext.getResources().getString(R.string.sms_by_shortcut, displayName);
    }

    final Intent shortcutIntent = new Intent(shortcutAction, phoneUri);
    shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    Intent intent = null;
    IconCompat compatAdaptiveIcon = null;
    if (BuildCompat.isAtLeastO()) {
        compatAdaptiveIcon = IconCompat.createWithAdaptiveBitmap(icon);
        final ShortcutManager sm = (ShortcutManager) mContext.getSystemService(Context.SHORTCUT_SERVICE);
        final String id = shortcutAction + lookupKey + phoneUri.toString().hashCode();
        final DynamicShortcuts dynamicShortcuts = new DynamicShortcuts(mContext);
        final ShortcutInfo shortcutInfo = dynamicShortcuts.getActionShortcutInfo(id, displayName,
                shortcutIntent, compatAdaptiveIcon.toIcon());
        if (shortcutInfo != null) {
            intent = sm.createShortcutResultIntent(shortcutInfo);
        }
    }

    intent = intent == null ? new Intent() : intent;
    // This will be non-null in O and above.
    if (compatAdaptiveIcon != null) {
        compatAdaptiveIcon.addToShortcutIntent(intent, null, mContext);
    } else {
        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
    }
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutName);

    mListener.onShortcutIntentCreated(uri, intent);
}

From source file:org.sirimangalo.meditationplus.ActivityMain.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    Intent i;/*from   www .ja va2  s  .c  o  m*/

    switch (id) {
    case R.id.action_htm:
        Utils.openHTM(this);
        return true;
    case R.id.action_refresh:
        listVersion = -1;
        chatVersion = -1;
        restartTimer = true;
        ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
        nvp.add(new BasicNameValuePair("full_update", "true"));
        doSubmit(null, nvp, true);
        return true;
    case R.id.action_profile:
        showProfile(username);
        return true;
    case R.id.action_schedule:
        i = new Intent(this, ActivitySchedule.class);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(i);
        return true;
    case R.id.action_settings:
        i = new Intent(this, ActivityPrefs.class);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(i);
        return true;
    case R.id.action_help:
        i = new Intent(this, ActivityHelp.class);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(i);
        return true;
    case R.id.action_share:

        String playStoreLink = "https://play.google.com/store/apps/details?id=" + getPackageName();
        String yourShareText = playStoreLink;
        Intent shareIntent = ShareCompat.IntentBuilder.from(this).setType("text/plain").setText(yourShareText)
                .setSubject("Meditation Plus").getIntent();
        // Set the share Intent
        startActivity(Intent.createChooser(shareIntent, "Share App via"));
        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.synchophy.ui.CoverFlowActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    Intent i = null;//  w w  w . jav  a  2s  .c  om

    switch (item.getItemId()) {

    case BrowseActivity.MAIN:
        i = new Intent(this, MainMenuActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(i);
        return true;
    case BrowseActivity.PLAYLIST:
        i = new Intent(this, PlaylistActivity.class);
        startActivityForResult(i, BrowseActivity.PLAYLIST);
        return true;
    case BrowseActivity.FILTER:
        PlayerManager.setFiltering(!PlayerManager.isFiltering());
        refresh();
        return true;
    }
    return false;
}

From source file:by.zatta.pilight.connection.ConnectionService.java

private static void makeNotification(NotificationType type, String message) {
    Intent main;/*  w  w w .j  a v a  2  s  .  c o  m*/
    Intent kill;
    PendingIntent sentBroadcast;
    PendingIntent startMainActivity;
    PendingIntent killService;

    String myDate = java.text.DateFormat.getTimeInstance().format(Calendar.getInstance().getTime());

    //Log.v(TAG, "setting notification: " + type.name() + " while current = " + mCurrentNotif.name());
    if (type != mCurrentNotif) {
        //Log.v(TAG, "setting NEW notification: " + type.name());
        sendMessageToUI(MSG_SET_STATUS, type.name());
        switch (type) {
        case DESTROYED:
            builder = new Notification.Builder(ctx);
            builder.setSmallIcon(R.drawable.eye_black).setLargeIcon(bigPic(R.drawable.eye_black))
                    .setContentTitle(aCtx.getString(R.string.app_name)).setContentText(message);
            mCurrentNotif = NotificationType.DESTROYED;
            break;
        case CONNECTING:
            kill = new Intent("pilight-kill-service");
            killService = PendingIntent.getBroadcast(ctx, 0, kill, PendingIntent.FLAG_UPDATE_CURRENT);

            builder = new Notification.Builder(ctx).setContentTitle(aCtx.getString(R.string.app_name))
                    .setContentText(message).setDeleteIntent(killService).setSmallIcon(R.drawable.eye_trans)
                    .setLargeIcon(bigPic(R.drawable.eye_trans));
            mCurrentNotif = NotificationType.CONNECTING;
            break;
        case CONNECTED:
            main = new Intent(ctx, MainActivity.class);
            main.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startMainActivity = PendingIntent.getActivity(ctx, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);

            builder = new Notification.Builder(ctx).setContentTitle(aCtx.getString(R.string.app_name))
                    .setContentText(message + "\n" + myDate).setContentIntent(startMainActivity)
                    .setSmallIcon(R.drawable.eye_white).setLargeIcon(bigPic(R.drawable.eye_white));
            mCurrentNotif = NotificationType.CONNECTED;
            break;
        case FAILED:
            main = new Intent("pilight-reconnect");
            sentBroadcast = PendingIntent.getBroadcast(ctx, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
            kill = new Intent("pilight-kill-service");
            killService = PendingIntent.getBroadcast(ctx, 0, kill, PendingIntent.FLAG_UPDATE_CURRENT);

            builder = new Notification.Builder(ctx).setContentTitle("pilight")
                    .setContentText(aCtx.getString(R.string.noti_failed)).setDeleteIntent(killService)
                    .addAction(R.drawable.action_refresh, aCtx.getString(R.string.noti_retry), sentBroadcast)
                    .setSmallIcon(R.drawable.eye_trans).setLargeIcon(bigPic(R.drawable.eye_trans));
            mCurrentNotif = NotificationType.FAILED;
            break;
        case LOST_CONNECTION:
            main = new Intent("pilight-reconnect");
            sentBroadcast = PendingIntent.getBroadcast(ctx, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
            kill = new Intent("pilight-kill-service");
            killService = PendingIntent.getBroadcast(ctx, 0, kill, PendingIntent.FLAG_UPDATE_CURRENT);

            builder = new Notification.Builder(ctx).setContentTitle(aCtx.getString(R.string.app_name))
                    .setContentText(message + "\n" + myDate).setDeleteIntent(killService)
                    .addAction(R.drawable.action_refresh, aCtx.getString(R.string.noti_retry), sentBroadcast)
                    .setSmallIcon(R.drawable.eye_trans).setLargeIcon(bigPic(R.drawable.eye_trans));
            mCurrentNotif = NotificationType.LOST_CONNECTION;
            break;
        case UPDATE:
            main = new Intent(ctx, MainActivity.class);
            main.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startMainActivity = PendingIntent.getActivity(ctx, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
            String[] title = message.split("\n");
            message = message.replace(title[0] + "\n", "");
            builder = new Notification.Builder(ctx).setContentTitle(title[0]).setContentText(message)
                    .setStyle(new Notification.BigTextStyle().bigText(message))
                    .setContentIntent(startMainActivity).setSmallIcon(R.drawable.eye_white)
                    .setLargeIcon(bigPic(R.drawable.eye_white));
            mCurrentNotif = NotificationType.UPDATE;
            break;
        default:
            break;
        }
    } else {
        if (message != null) {
            if (message.contains("Stamp")) {
                String[] title = message.split("\n");
                message = message.replace(title[0] + "\n", "");
                builder.setContentTitle(title[0]).setStyle(new Notification.BigTextStyle().bigText(message));
                builder.setContentText(message);
            } else {
                builder.setContentTitle(myDate).setStyle(new Notification.BigTextStyle().bigText(message));
                builder.setContentText(message);
            }
        }
    }
    mNotMan.notify(35, builder.build());
}

From source file:am.roadpolice.roadpolice.alarm.AlarmReceiver.java

@Override
public void submissionCompleted(ArrayList<ViolationInfo> list, String result) {
    // If errors occurs while trying to update data.
    if (!TextUtils.isEmpty(result)) {
        final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
        SharedPreferences.Editor ed = sp.edit();
        ed.putBoolean(MainActivity.MISS_UPDATE_DUE_TO_NETWORK_ISSUE, true);
        ed.apply();/*from   ww w . j a  v  a2 s .  c o  m*/
        return;
    }

    SQLiteHelper dbHelper = new SQLiteHelper(mContext);
    // Get list of new violation info, if null no new items found.
    ArrayList<ViolationInfo> newViolationInfoList = dbHelper.insertViolationInfoListAndCheckNew(list);

    // Create notification.
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext);
    // Create notification Title Text.
    int updateInterval = DialogSettings.getUpdateInterval(mContext);
    switch (updateInterval) {
    case DialogSettings.DAILY:
        mBuilder.setContentTitle(mContext.getString(R.string.txtDailyNotification));
        break;

    case DialogSettings.WEEKLY:
        mBuilder.setContentTitle(mContext.getString(R.string.txtWeeklyNotification));
        break;

    case DialogSettings.MONTHLY:
        mBuilder.setContentTitle(mContext.getString(R.string.txtMonthlyNotification));
        break;
    }

    // Create notification message.
    if (newViolationInfoList == null || newViolationInfoList.size() < 1) {
        mBuilder.setContentText(mContext.getString(R.string.txtNoViolationNotification));
        mBuilder.setSmallIcon(R.drawable.ic_checked);
    } else {
        mBuilder.setContentText(mContext.getString(R.string.txtYesViolationNotification));
        mBuilder.setSmallIcon(R.drawable.ic_attention);
    }

    // Activate vibration and sound.
    mBuilder.setDefaults(Notification.DEFAULT_SOUND);
    mBuilder.setDefaults(Notification.DEFAULT_VIBRATE);
    mBuilder.setAutoCancel(true);

    // Set intent to open Main Activity, when user click on notification.
    Intent notificationIntent = new Intent(mContext, MainActivity.class);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent mainActivityPendingIntent = PendingIntent.getActivity(mContext, 0, notificationIntent, 0);

    mBuilder.setContentIntent(mainActivityPendingIntent);

    // Show notification.
    NotificationManager mNotificationManager = (NotificationManager) mContext
            .getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(0, mBuilder.build());

    // Get shared preferences.
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
    SharedPreferences.Editor ed = sp.edit();
    ed.putBoolean(MainActivity.MISS_UPDATE_DUE_TO_NETWORK_ISSUE, false);
    ed.apply();

}

From source file:com.github.barcodeeye.scan.CaptureActivity.java

private void handleDecodeInternally(Result rawResult, Bitmap barcode) {

    Uri imageUri = null;//  w  w  w .j a va 2s.c om
    String imageName = IMAGE_PREFIX + System.currentTimeMillis() + ".png";
    Log.v(TAG, "Saving image as: " + imageName);
    try {
        imageUri = mImageManager.saveImage(imageName, barcode);
    } catch (IOException e) {
        Log.e(TAG, "Failed to save image!", e);
    }

    ResultProcessor<?> processor = ResultProcessorFactory.makeResultProcessor(this, rawResult, imageUri);

    if (!validateQRcode(rawResult.toString())) {
        Toast.makeText(getApplicationContext(), "Invalid QR code!", Toast.LENGTH_SHORT).show();
        onResume();
    } else {

        File f = new File(getCacheDir(), "LoginData.txt");

        FileOutputStream fos = null;
        try {
            if (!f.exists()) {
                f.createNewFile();
            }

            fos = new FileOutputStream(f, false);
            fos.write(rawResult.toString().getBytes());
            fos.close();

        } catch (IOException e) {
            Log.e(TAG, "Failed to save Login!", e);
        }

        // Intent Creation and Initialization
        Intent intent = new Intent(context2, InformationPreviewActivity.class);
        //I have added the line: (flags) (for closing the first activity)
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        // Create a Bundle and Put Bundle into it (SENDS PERSON)
        Bundle bundleObject = new Bundle();
        bundleObject.putSerializable("key", rawResult.toString());
        // Put Bundle into Intent and call start Activity
        intent.putExtras(bundleObject);
        startActivity(intent);
        //I have added the line: (finish) (for closing the first activity)
        finish();
    }
    //        startActivity(ResultsActivity.newIntent(this,processor.getCardResults()));
}

From source file:gr.scify.newsum.ui.SearchViewActivity.java

private void initTopicSpinner() {
    // Get topics in category. Null accepts all user sources. Modify
    // according to user selection
    final String[] saTopicIDs = SearchTopicActivity.saTopicIDs;
    final String[] saTitles = SearchTopicActivity.saTopicTitles;
    final String[] saDates = SearchTopicActivity.saTopicDates;
    // TODO add TopicInfo for SearchResults as well and parse accordingly

    // final String[] saTopicIDs = extras.getStringArray("searchresults");
    final TextView title = (TextView) findViewById(R.id.title);
    // Fill topic spinner
    ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this,
            android.R.layout.simple_spinner_item, saTitles);

    final TextView tx = (TextView) findViewById(R.id.textView1);
    // tx.setMovementMethod(LinkMovementMethod.getInstance());
    //      final float minm = tx.getTextSize();
    //      final float maxm = (minm + 24);

    // create an invisible spinner just to control the summaries of the
    // category (i will use it later on Swipe)
    Spinner spinner = (Spinner) findViewById(R.id.spinner1);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);/*w w w.  j a va  2  s  . com*/

    // Scroll view init
    final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView1);
    // Add selection event
    spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

            // Show waiting dialog
            showWaitingDialog();

            // Changing summary
            loading = true;
            // Update visibility of rating bar
            final RatingBar rb = (RatingBar) findViewById(R.id.ratingBar);
            rb.setRating(0.0f);
            rb.setVisibility(View.VISIBLE);
            final TextView rateLbl = (TextView) findViewById(R.id.rateLbl);
            rateLbl.setVisibility(View.VISIBLE);

            scroll.scrollTo(0, 0);
            //            String[] saTopicIDs = sTopicIds.split(sSeparator);

            SharedPreferences settings = getSharedPreferences("urls", 0);
            // get user settings for sources
            String UserSources = settings.getString("UserLinks", "All");
            String[] Summary = NewSumServiceClient.getSummary(saTopicIDs[arg2], UserSources);
            if (Summary.length == 0) { // WORK. Updated: CHECK
                // Close waiting dialog
                closeWaitingDialog();

                AlertDialog.Builder alert = new AlertDialog.Builder(SearchViewActivity.this);
                alert.setMessage(R.string.shouldReloadSummaries);
                alert.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface arg0, int arg1) {
                        startActivity(new Intent(getApplicationContext(), NewSumUiActivity.class)
                                .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
                    }
                });
                alert.setCancelable(false);
                alert.show();
                loading = false;
                return;
            }
            // track summary views per Search and topic title
            if (getAnalyticsPref()) {
                EasyTracker.getTracker().sendEvent(VIEW_SUMMARY_ACTION, "From Search",
                        saTitles[arg2] + ": " + saDates[arg2], 0l);
            }
            // Generate summary text
            sText = ViewActivity.generateSummaryText(Summary, SearchViewActivity.this);
            pText = ViewActivity.generatesummarypost(Summary, SearchViewActivity.this);
            tx.setText(Html.fromHtml(sText));
            tx.setMovementMethod(LinkMovementMethod.getInstance());
            title.setText(saTitles[arg2] + ": " + saDates[arg2]);
            float defSize = tx.getTextSize();
            SharedPreferences usersize = getSharedPreferences("textS", 0);
            float newSize = usersize.getFloat("size", defSize);
            tx.setTextSize(TypedValue.COMPLEX_UNIT_PX, newSize);
            // update the TopicActivity with viewed item
            TopicActivity.addVisitedTopicID(saTopicIDs[arg2]);

            // Close waiting dialog
            closeWaitingDialog();

        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }

    });

}