Example usage for android.content Context CLIPBOARD_SERVICE

List of usage examples for android.content Context CLIPBOARD_SERVICE

Introduction

In this page you can find the example usage for android.content Context CLIPBOARD_SERVICE.

Prototype

String CLIPBOARD_SERVICE

To view the source code for android.content Context CLIPBOARD_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.content.ClipboardManager for accessing and modifying the contents of the global clipboard.

Usage

From source file:com.microsoft.office365.msgraphsnippetapp.SnippetDetailFragment.java

@TargetApi(11)
private void clipboard11(TextView tv) {
    android.content.ClipboardManager clipboardManager = (android.content.ClipboardManager) getActivity()
            .getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData clipData = ClipData.newPlainText("RESTSnippets", tv.getText());
    clipboardManager.setPrimaryClip(clipData);
}

From source file:org.sufficientlysecure.keychain.ui.ViewKeyAdvShareFragment.java

private void shareKey(boolean toClipboard) {
    Activity activity = getActivity();//www.  j  a  v a 2s .co  m
    if (activity == null || mFingerprint == null) {
        return;
    }
    ProviderHelper providerHelper = new ProviderHelper(activity);

    try {
        String content = providerHelper
                .getKeyRingAsArmoredString(KeychainContract.KeyRingData.buildPublicKeyRingUri(mDataUri));

        if (toClipboard) {
            ClipboardManager clipMan = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
            if (clipMan == null) {
                Notify.create(activity, R.string.error_clipboard_copy, Style.ERROR);
                return;
            }

            ClipData clip = ClipData.newPlainText(Constants.CLIPBOARD_LABEL, content);
            clipMan.setPrimaryClip(clip);

            Notify.create(activity, R.string.key_copied_to_clipboard, Notify.Style.OK).show();
            return;
        }

        // let user choose application
        Intent sendIntent = new Intent(Intent.ACTION_SEND);
        sendIntent.setType(Constants.MIME_TYPE_KEYS);

        // NOTE: Don't use Intent.EXTRA_TEXT to send the key
        // better send it via a Uri!
        // example: Bluetooth Share will convert text/plain sent via Intent.EXTRA_TEXT to HTML
        try {
            TemporaryFileProvider shareFileProv = new TemporaryFileProvider();

            String filename = KeyFormattingUtils.convertFingerprintToHex(mFingerprint);
            OpenPgpUtils.UserId mainUserId = KeyRing.splitUserId(mUserId);
            if (mainUserId.name != null) {
                filename = mainUserId.name;
            }
            Uri contentUri = TemporaryFileProvider.createFile(activity,
                    filename + Constants.FILE_EXTENSION_ASC);

            BufferedWriter contentWriter = new BufferedWriter(new OutputStreamWriter(
                    new ParcelFileDescriptor.AutoCloseOutputStream(shareFileProv.openFile(contentUri, "w"))));
            contentWriter.write(content);
            contentWriter.close();

            sendIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
        } catch (FileNotFoundException e) {
            Log.e(Constants.TAG, "Error creating temporary key share file!", e);
            // no need for a snackbar because one sharing option doesn't work
            // Notify.create(getActivity(), R.string.error_temp_file, Notify.Style.ERROR).show();
        }

        String title = getString(R.string.title_share_key);
        Intent shareChooser = Intent.createChooser(sendIntent, title);

        startActivity(shareChooser);
    } catch (PgpGeneralException | IOException e) {
        Log.e(Constants.TAG, "error processing key!", e);
        Notify.create(activity, R.string.error_key_processing, Notify.Style.ERROR).show();
    } catch (ProviderHelper.NotFoundException e) {
        Log.e(Constants.TAG, "key not found!", e);
        Notify.create(activity, R.string.error_key_not_found, Notify.Style.ERROR).show();
    }
}

From source file:arun.com.chameleonskinforkwlp.MainActivity.java

public void onFormulaClicked(View view) {
    if (view instanceof TextView) {
        TextView textView = (TextView) view;
        final ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        final CharSequence textToCopy = textView.getText();
        final ClipData clip = ClipData.newPlainText("formula", textToCopy);
        Snackbar.make(binding.coordinatorLayout, String.format(getString(R.string.copied_alert), textToCopy),
                Snackbar.LENGTH_SHORT).show();
        clipboard.setPrimaryClip(clip);//ww  w .j  a v a 2  s . c  om
    }
}

From source file:com.flym.dennikn.fragment.EntryFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mEntriesIds != null) {
        Activity activity = getActivity();

        switch (item.getItemId()) {
        case R.id.menu_star: {
            mFavorite = !mFavorite;/*from   w w w  .jav  a 2 s .  com*/

            if (mFavorite) {
                item.setTitle(R.string.menu_unstar).setIcon(R.drawable.rating_important);
            } else {
                item.setTitle(R.string.menu_star).setIcon(R.drawable.rating_not_important);
            }

            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentValues values = new ContentValues();
                    values.put(EntryColumns.IS_FAVORITE, mFavorite ? 1 : 0);
                    ContentResolver cr = MainApplication.getContext().getContentResolver();
                    cr.update(uri, values, null, null);

                    // Update the cursor
                    Cursor updatedCursor = cr.query(uri, null, null, null, null);
                    updatedCursor.moveToFirst();
                    mEntryPagerAdapter.setUpdatedCursor(mCurrentPagerPos, updatedCursor);
                }
            }.start();
            break;
        }
        case R.id.menu_share: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            if (cursor != null) {
                String link = cursor.getString(mLinkPos);
                if (link != null) {
                    String title = cursor.getString(mTitlePos);
                    startActivity(Intent.createChooser(
                            new Intent(Intent.ACTION_SEND).putExtra(Intent.EXTRA_SUBJECT, title)
                                    .putExtra(Intent.EXTRA_TEXT, link).setType(Constants.MIMETYPE_TEXT_PLAIN),
                            getString(R.string.menu_share)));
                }
            }
            break;
        }
        case R.id.menu_full_screen: {
            setImmersiveFullScreen(true);
            break;
        }
        case R.id.menu_copy_clipboard: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            String link = cursor.getString(mLinkPos);
            ClipboardManager clipboard = (ClipboardManager) activity
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("Copied Text", link);
            clipboard.setPrimaryClip(clip);

            Toast.makeText(activity, R.string.copied_clipboard, Toast.LENGTH_SHORT).show();
            break;
        }
        case R.id.menu_mark_as_unread: {
            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentResolver cr = MainApplication.getContext().getContentResolver();
                    cr.update(uri, FeedData.getUnreadContentValues(), null, null);
                }
            }.start();
            activity.finish();
            break;
        }
        }
    }

    return true;
}

From source file:com.viktorrudometkin.burramys.fragment.EntryFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mEntriesIds != null) {
        Activity activity = getActivity();

        switch (item.getItemId()) {
        case R.id.menu_star: {
            mFavorite = !mFavorite;/* w w w  .j  a  v a  2  s  .  c  o  m*/

            if (mFavorite) {
                item.setTitle(R.string.menu_unstar).setIcon(R.drawable.rating_important);
            } else {
                item.setTitle(R.string.menu_star).setIcon(R.drawable.rating_not_important);
            }

            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentValues values = new ContentValues();
                    values.put(EntryColumns.IS_FAVORITE, mFavorite ? 1 : 0);
                    ContentResolver cr = MainApplication.getContext().getContentResolver();
                    cr.update(uri, values, null, null);

                    // Update the cursor
                    Cursor updatedCursor = cr.query(uri, null, null, null, null);
                    updatedCursor.moveToFirst();
                    mEntryPagerAdapter.setUpdatedCursor(mCurrentPagerPos, updatedCursor);
                }
            }.start();
            break;
        }
        case R.id.menu_share: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            if (cursor != null) {
                String link = cursor.getString(mLinkPos);
                if (link != null) {
                    String title = cursor.getString(mTitlePos);
                    startActivity(Intent.createChooser(
                            new Intent(Intent.ACTION_SEND).putExtra(Intent.EXTRA_SUBJECT, title)
                                    .putExtra(Intent.EXTRA_TEXT, link).setType(Constants.MIMETYPE_TEXT_PLAIN),
                            getString(R.string.menu_share)));
                }
            }
            break;
        }
        case R.id.menu_full_screen: {
            setImmersiveFullScreen(true);
            break;
        }
        case R.id.menu_copy_clipboard: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            String link = cursor.getString(mLinkPos);
            ClipboardManager clipboard = (ClipboardManager) activity
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("Copied Text", link);
            clipboard.setPrimaryClip(clip);

            UiUtils.showMessage(getActivity(), R.string.copied_clipboard);
            break;
        }
        case R.id.menu_mark_as_unread: {
            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentResolver cr = MainApplication.getContext().getContentResolver();
                    cr.update(uri, FeedData.getUnreadContentValues(), null, null);
                }
            }.start();
            activity.finish();
            break;
        }
        }
    }

    return true;
}

From source file:com.carlrice.reader.fragment.EntryFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mEntriesIds != null) {
        Activity activity = getActivity();

        switch (item.getItemId()) {
        case R.id.menu_star: {
            mFavorite = !mFavorite;/*  w ww .j a  v a  2s.c  om*/

            if (mFavorite) {
                item.setTitle(R.string.menu_unstar).setIcon(R.drawable.rating_important);
            } else {
                item.setTitle(R.string.menu_star).setIcon(R.drawable.rating_not_important);
            }

            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentValues values = new ContentValues();
                    values.put(EntryColumns.IS_FAVORITE, mFavorite ? 1 : 0);
                    ContentResolver cr = Application.context().getContentResolver();
                    cr.update(uri, values, null, null);

                    // Update the cursor
                    Cursor updatedCursor = cr.query(uri, null, null, null, null);
                    updatedCursor.moveToFirst();
                    mEntryPagerAdapter.setUpdatedCursor(mCurrentPagerPos, updatedCursor);
                }
            }.start();
            break;
        }
        case R.id.menu_share: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            if (cursor != null) {
                String link = cursor.getString(mLinkPos);
                if (link != null) {
                    String title = cursor.getString(mTitlePos);
                    startActivity(Intent.createChooser(
                            new Intent(Intent.ACTION_SEND).putExtra(Intent.EXTRA_SUBJECT, title)
                                    .putExtra(Intent.EXTRA_TEXT, link).setType(Constants.MIMETYPE_TEXT_PLAIN),
                            getString(R.string.menu_share)));
                }
            }
            break;
        }
        case R.id.menu_full_screen: {
            setImmersiveFullScreen(true);
            break;
        }
        case R.id.menu_copy_clipboard: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            String link = cursor.getString(mLinkPos);
            ClipboardManager clipboard = (ClipboardManager) activity
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("Copied Text", link);
            clipboard.setPrimaryClip(clip);

            Toast.makeText(activity, R.string.copied_clipboard, Toast.LENGTH_SHORT).show();
            break;
        }
        case R.id.menu_mark_as_unread: {
            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentResolver cr = Application.context().getContentResolver();
                    cr.update(uri, FeedData.getUnreadContentValues(), null, null);
                }
            }.start();
            activity.finish();
            break;
        }
        }
    }

    return true;
}

From source file:ru.valle.btc.MainActivity.java

@SuppressWarnings("deprecation")
private String getTextInClipboard() {
    CharSequence textInClipboard = "";
    if (Build.VERSION.SDK_INT >= 11) {
        if (clipboardHelper.hasTextInClipboard()) {
            textInClipboard = clipboardHelper.getTextInClipboard();
        }/* www .  j a v a  2s  .co m*/
    } else {
        android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(
                Context.CLIPBOARD_SERVICE);
        if (clipboard.hasText()) {
            textInClipboard = clipboard.getText();
        }
    }
    return textInClipboard == null ? "" : textInClipboard.toString();
}

From source file:net.etuldan.sparss.fragment.EntryFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mEntriesIds != null) {
        final Activity activity = getActivity();

        switch (item.getItemId()) {
        case R.id.menu_star: {
            mFavorite = !mFavorite;//  w  w w.j a v a2  s  . c  o  m

            if (mFavorite) {
                item.setTitle(R.string.menu_unstar).setIcon(R.drawable.ic_star);
            } else {
                item.setTitle(R.string.menu_star).setIcon(R.drawable.ic_star_border);
            }

            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentValues values = new ContentValues();
                    values.put(EntryColumns.IS_FAVORITE, mFavorite ? 1 : 0);
                    ContentResolver cr = MainApplication.getContext().getContentResolver();
                    cr.update(uri, values, null, null);

                    // Update the cursor
                    Cursor updatedCursor = cr.query(uri, null, null, null, null);
                    updatedCursor.moveToFirst();
                    mEntryPagerAdapter.setUpdatedCursor(mCurrentPagerPos, updatedCursor);
                }
            }.start();
            break;
        }
        case R.id.menu_share: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            if (cursor != null) {
                String link = cursor.getString(mLinkPos);
                if (link != null) {
                    String title = cursor.getString(mTitlePos);
                    startActivity(Intent.createChooser(
                            new Intent(Intent.ACTION_SEND).putExtra(Intent.EXTRA_SUBJECT, title)
                                    .putExtra(Intent.EXTRA_TEXT, link).setType(Constants.MIMETYPE_TEXT_PLAIN),
                            getString(R.string.menu_share)));
                }
            }
            break;
        }
        case R.id.menu_full_screen: {
            setImmersiveFullScreen(true);
            break;
        }
        case R.id.menu_copy_clipboard: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            String link = cursor.getString(mLinkPos);
            ClipboardManager clipboard = (ClipboardManager) activity
                    .getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("Copied Text", link);
            clipboard.setPrimaryClip(clip);

            Toast.makeText(activity, R.string.copied_clipboard, Toast.LENGTH_SHORT).show();
            break;
        }
        case R.id.menu_mark_as_unread: {
            final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]);
            new Thread() {
                @Override
                public void run() {
                    ContentResolver cr = MainApplication.getContext().getContentResolver();
                    cr.update(uri, FeedData.getUnreadContentValues(), null, null);
                }
            }.start();
            activity.finish();
            break;
        }
        case R.id.menu_open_in_browser: {
            Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
            if (cursor != null) {
                String link = cursor.getString(mLinkPos);
                if (link != null) {
                    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
                    startActivity(browserIntent);
                }
            }
            break;
        }
        case R.id.menu_switch_full_original: {
            isChecked = !item.isChecked();
            item.setChecked(isChecked);
            if (mPreferFullText) {
                getActivity().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        mPreferFullText = false;
                        mEntryPagerAdapter.displayEntry(mCurrentPagerPos, null, true);
                    }
                });
            } else {
                Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos);
                final boolean alreadyMobilized = !cursor.isNull(mMobilizedHtmlPos);

                if (alreadyMobilized) {
                    activity.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            mPreferFullText = true;
                            mEntryPagerAdapter.displayEntry(mCurrentPagerPos, null, true);
                        }
                    });
                } else if (!isRefreshing()) {
                    ConnectivityManager connectivityManager = (ConnectivityManager) activity
                            .getSystemService(Context.CONNECTIVITY_SERVICE);
                    final NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();

                    // since we have acquired the networkInfo, we use it for basic checks
                    if (networkInfo != null && networkInfo.getState() == NetworkInfo.State.CONNECTED) {
                        FetcherService.addEntriesToMobilize(new long[] { mEntriesIds[mCurrentPagerPos] });
                        activity.startService(new Intent(activity, FetcherService.class)
                                .setAction(FetcherService.ACTION_MOBILIZE_FEEDS));
                        activity.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                showSwipeProgress();
                            }
                        });
                    } else {
                        activity.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                Toast.makeText(activity, R.string.network_error, Toast.LENGTH_SHORT).show();
                            }
                        });
                    }
                }
            }
            break;
        }
        default:
            break;
        }
    }

    return super.onOptionsItemSelected(item);
}

From source file:es.glasspixel.wlanaudit.fragments.ScanFragment.java

@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void copyClipboard(CharSequence text) {
    int sdk = android.os.Build.VERSION.SDK_INT;
    if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
        android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getActivity()
                .getSystemService(Context.CLIPBOARD_SERVICE);
        clipboard.setText(text);//from   w  w w.  ja va  2s. c o  m
    } else {
        android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getActivity()
                .getSystemService(Context.CLIPBOARD_SERVICE);
        android.content.ClipData clip = android.content.ClipData.newPlainText("text label", text);
        clipboard.setPrimaryClip(clip);
    }
    Toast.makeText(getSherlockActivity(), getResources().getString(R.string.key_copy_success),
            Toast.LENGTH_SHORT).show();

}

From source file:com.adam.aslfms.service.ScrobblingService.java

private void handleCommand(Intent i, int startId) {
    if (i == null) {
        Log.e(TAG, "got null intent");
        return;/*from  ww w  . j ava  2s.c  om*/
    }
    String action = i.getAction();
    Bundle extras = i.getExtras();
    if (action.equals(ACTION_CLEARCREDS)) {
        if (extras.getBoolean("clearall", false)) {
            mNetManager.launchClearAllCreds();
        } else {
            String snapp = extras.getString("netapp");
            if (snapp != null) {
                mNetManager.launchClearCreds(NetApp.valueOf(snapp));
            } else
                Log.e(TAG, "launchClearCreds got null napp");
        }
    } else if (action.equals(ACTION_AUTHENTICATE)) {
        String snapp = extras.getString("netapp");
        if (snapp != null)
            mNetManager.launchAuthenticator(NetApp.valueOf(snapp));
        else {
            Log.e(TAG, "launchHandshaker got null napp");
            mNetManager.launchHandshakers();
        }
    } else if (action.equals(ACTION_JUSTSCROBBLE)) {
        if (extras.getBoolean("scrobbleall", false)) {
            Log.d(TAG, "Scrobble All TRUE");
            mNetManager.launchAllScrobblers();
        } else {
            Log.e(TAG, "Scrobble All False");
            String snapp = extras.getString("netapp");
            if (snapp != null) {
                mNetManager.launchScrobbler(NetApp.valueOf(snapp));
            } else
                Log.e(TAG, "launchScrobbler got null napp");
        }
    } else if (action.equals(ACTION_PLAYSTATECHANGED)) {
        if (extras == null) {
            Log.e(TAG, "Got null extras on playstatechange");
            return;
        }
        Track.State state = Track.State.valueOf(extras.getString("state"));

        Track track = InternalTrackTransmitter.popTrack();

        if (track == null) {
            Log.e(TAG, "A null track got through!! (Ignoring it)");
            return;
        }

        onPlayStateChanged(track, state);

    } else if (action.equals(ACTION_HEART)) {
        if (!settings.getUsername(NetApp.LASTFM).equals("")) {
            if (mCurrentTrack != null && mCurrentTrack.hasBeenQueued()) {
                try {
                    if (mDb.fetchRecentTrack() == null) {
                        Toast.makeText(this, this.getString(R.string.no_heart_track), Toast.LENGTH_LONG).show();
                    } else {
                        mDb.loveRecentTrack();
                        Toast.makeText(this, this.getString(R.string.song_is_ready), Toast.LENGTH_SHORT).show();
                        Log.d(TAG, "Love Track Rating!");
                    }
                } catch (Exception e) {
                    Log.e(TAG, "CAN'T COPY TRACK" + e);
                }
            } else if (mCurrentTrack != null) {
                mCurrentTrack.setRating();
                Toast.makeText(this, this.getString(R.string.song_is_ready), Toast.LENGTH_SHORT).show();
                Log.d(TAG, "Love Track Rating!");
            } else {
                Toast.makeText(this, this.getString(R.string.no_current_track), Toast.LENGTH_SHORT).show();
            }
        } else {
            Toast.makeText(this, this.getString(R.string.no_lastFm), Toast.LENGTH_LONG).show();
        }
    } else if (action.equals(ACTION_COPY)) {
        if (mCurrentTrack != null && mCurrentTrack.hasBeenQueued()) {
            try {
                Log.e(TAG, mDb.fetchRecentTrack().toString());
                Track tempTrack = mDb.fetchRecentTrack();
                int sdk = Build.VERSION.SDK_INT;
                if (sdk < Build.VERSION_CODES.HONEYCOMB) {
                    android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(
                            Context.CLIPBOARD_SERVICE);
                    clipboard.setText(tempTrack.getTrack() + " by " + tempTrack.getArtist() + ", "
                            + tempTrack.getAlbum());
                } else {
                    android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(
                            Context.CLIPBOARD_SERVICE);
                    android.content.ClipData clip = android.content.ClipData.newPlainText("Track",
                            tempTrack.getTrack() + " by " + tempTrack.getArtist() + ", "
                                    + tempTrack.getAlbum());
                    clipboard.setPrimaryClip(clip);
                }
                Log.d(TAG, "Copy Track!");
            } catch (Exception e) {
                Toast.makeText(this, this.getString(R.string.no_copy_track), Toast.LENGTH_LONG).show();
                Log.e(TAG, "CAN'T COPY TRACK" + e);
            }
        } else if (mCurrentTrack != null) {
            try {
                int sdk = Build.VERSION.SDK_INT;
                if (sdk < Build.VERSION_CODES.HONEYCOMB) {
                    android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(
                            Context.CLIPBOARD_SERVICE);
                    clipboard.setText(mCurrentTrack.getTrack() + " by " + mCurrentTrack.getArtist() + ", "
                            + mCurrentTrack.getAlbum());
                } else {
                    android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(
                            Context.CLIPBOARD_SERVICE);
                    android.content.ClipData clip = android.content.ClipData.newPlainText("Track",
                            mCurrentTrack.getTrack() + " by " + mCurrentTrack.getArtist() + ", "
                                    + mCurrentTrack.getAlbum());
                    clipboard.setPrimaryClip(clip);
                }
                Log.d(TAG, "Copy Track!");
            } catch (Exception e) {
                Toast.makeText(this, this.getString(R.string.no_copy_track), Toast.LENGTH_LONG).show();
                Log.e(TAG, "CAN'T COPY TRACK" + e);
            }
        } else {
            Toast.makeText(this, this.getString(R.string.no_current_track), Toast.LENGTH_SHORT).show();
        }
    } else {
        Log.e(TAG, "Weird action in onStart: " + action);
    }
}