Example usage for android.content Intent EXTRA_TITLE

List of usage examples for android.content Intent EXTRA_TITLE

Introduction

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

Prototype

String EXTRA_TITLE

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

Click Source Link

Document

A CharSequence dialog title to provide to the user when used with a #ACTION_CHOOSER .

Usage

From source file:com.cmput301.recipebot.ui.AbstractRecipeActivity.java

/**
 * Creates a sharing {@link android.content.Intent}.
 * Shares mRecipe, doesn't get it from the UI.
 *
 * @return The sharing intent./*from www . ja  va2s . co m*/
 */
private static Intent createShareIntent(Recipe recipe, File file) {
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, recipe.getName());
    shareIntent.putExtra(Intent.EXTRA_TITLE, recipe.getName());
    shareIntent.putExtra(Intent.EXTRA_TEXT, recipe.toEmail());
    shareIntent.setType("application/json");
    shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
    return shareIntent;
}

From source file:net.peterkuterna.android.apps.devoxxsched.ui.MapFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    mOverlays.clear();/*from   ww  w.  j  ava 2s. c  om*/

    mOverlays.add(new MetropolisOverlay());

    while (data.moveToNext()) {
        final String roomId = data.getString(RoomsQuery.ROOM_ID);
        final String roomName = data.getString(RoomsQuery.ROOM_NAME);
        final int selectable = data.getInt(RoomsQuery.ROOM_SELECTABLE);

        final String encodedPoly = data.getString(RoomsQuery.ROOM_ENCODED_POLY);
        if (!TextUtils.isEmpty(encodedPoly)) {
            final RoomOverlay overlay = new RoomOverlay(roomName, selectable == 1, encodedPoly,
                    roomId.equals(mRoomId));
            overlay.setOnTapListener(new OnTapListener() {
                @Override
                public void onTap() {
                    final Uri sessionsUri = Rooms.buildSessionsDirUri(roomId);
                    AnalyticsUtils.getInstance(getActivity()).trackEvent("Map", "Click", roomName, 0);
                    final Intent intent = new Intent(Intent.ACTION_VIEW, sessionsUri);
                    final String title = getResources().getString(R.string.title_sessions_in, roomName);
                    intent.putExtra(Intent.EXTRA_TITLE, title);
                    ((BaseActivity) getSupportActivity()).openActivityOrFragment(intent);
                }
            });
            mOverlays.add(overlay);
        }
    }

    mMapView.postInvalidate();
}

From source file:com.pemikir.youtubeplus.ActionBarHandler.java

public void playVideo() {
    // ----------- THE MAGIC MOMENT ---------------
    if (!videoTitle.isEmpty()) {
        if (PreferenceManager.getDefaultSharedPreferences(context)
                .getBoolean(context.getString(R.string.useExternalPlayer), false)) {

            // External Player
            Intent intent = new Intent();
            try {
                intent.setAction(Intent.ACTION_VIEW);

                intent.setDataAndType(Uri.parse(videoStreams[selectedStream].url),
                        VideoInfo.getMimeById(videoStreams[selectedStream].format));
                intent.putExtra(Intent.EXTRA_TITLE, videoTitle);
                intent.putExtra("title", videoTitle);

                context.startActivity(intent); // HERE !!!
            } catch (Exception e) {
                e.printStackTrace();//ww  w  .ja v a  2s  .c o  m
                AlertDialog.Builder builder = new AlertDialog.Builder(context);
                builder.setMessage(R.string.noPlayerFound)
                        .setPositiveButton(R.string.installStreamPlayer, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                Intent intent = new Intent();
                                intent.setAction(Intent.ACTION_VIEW);
                                intent.setData(Uri.parse(context.getString(R.string.fdroidVLCurl)));
                                context.startActivity(intent);
                            }
                        }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {

                            }
                        });
                builder.create().show();
            }
        } else {
            // Internal Player
            Intent intent = new Intent(context, PlayVideoActivity.class);
            intent.putExtra(PlayVideoActivity.VIDEO_TITLE, videoTitle);
            intent.putExtra(PlayVideoActivity.STREAM_URL, videoStreams[selectedStream].url);
            intent.putExtra(PlayVideoActivity.VIDEO_URL, webisteUrl);
            context.startActivity(intent);
        }
    }
    // --------------------------------------------
}

From source file:de.awisus.refugeeaidleipzig.views.profile.FragmentEditOffer.java

private void startChooser() {
    Intent intentGalerie;/*from   ww w. ja va  2  s.c  o m*/
    intentGalerie = new Intent(Intent.ACTION_PICK);
    intentGalerie.setType("image/*");

    Intent chooser = new Intent(Intent.ACTION_CHOOSER);
    chooser.putExtra(Intent.EXTRA_INTENT, intentGalerie);
    chooser.putExtra(Intent.EXTRA_TITLE, R.string.titel_select_image);

    Intent[] intentArray = { new Intent(MediaStore.ACTION_IMAGE_CAPTURE) };
    chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);

    startActivityForResult(chooser, WAEHLE_BILD);
}

From source file:net.HeZi.Android.HeInputLibrary.HeInput_Activation_Fragment.java

private void showChineseDialectSelection() {
    Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);

    intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, inputId);
    intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.select_chinese_dialect_title)); //"Select Enabled Subtypes"
    startActivity(intent);/*from  w  w w .  j a  v  a  2  s  . c om*/
}

From source file:com.activiti.android.platform.provider.transfer.ContentTransferManager.java

public static final void requestCreateLocalContent(Fragment fr, String filename, String mimetype, File file) {

    if (AndroidVersion.isKitKatOrAbove()) {
        Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType(mimetype);/* ww w  .  j a  v a 2 s .  c  o m*/
        intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
        intent.putExtra(Intent.EXTRA_TITLE, filename);
        fr.startActivityForResult(intent, CREATE_REQUEST_CODE);
    } else {
        // Good question ? Send Intent ? File Picker ?
    }
}

From source file:com.albedinsky.android.support.intent.ShareIntent.java

/**
 *//*w  w w .  j  a  va 2 s.com*/
@NonNull
@Override
protected Intent onBuild() {
    final Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType(mDataType);
    if (!TextUtils.isEmpty(mTitle)) {
        intent.putExtra(Intent.EXTRA_TITLE, mTitle);
    }
    if (!TextUtils.isEmpty(mContent)) {
        intent.putExtra(Intent.EXTRA_TEXT, mContent);
    }
    if (mUri != null) {
        intent.putExtra(Intent.EXTRA_STREAM, mUri);
    } else if (mUris != null) {
        intent.setAction(Intent.ACTION_SEND_MULTIPLE);
        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, new ArrayList<Parcelable>(mUris));
    }
    return intent;
}

From source file:com.repkap11.repcast.activities.RepcastActivity.java

public void showFileWithURL(JsonDirectory.JsonFileDir dir, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    Uri uri = Uri.parse(url);//from  ww w  .  jav a2 s .c o m
    Log.e(TAG, "Uri:" + uri);
    Log.e(TAG, "MemeType:" + dir.memeType);
    intent.setDataAndType(uri, dir.memeType);
    intent.putExtra(Intent.EXTRA_TITLE, dir.name);
    if (dir.memeType.equals("video/mp4") || dir.memeType.equals("audio/mpeg")
            || dir.memeType.equals("video/x-matroska")) {
        intent.setClass(this, LocalPlayerActivity.class);
        startActivity(intent);
    } else {
        startActivity(Intent.createChooser(intent, "Select an App"));

    }
}

From source file:com.android.documentsui.DocumentsActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    mRoots = DocumentsApplication.getRootsCache(this);

    setResult(Activity.RESULT_CANCELED);
    setContentView(R.layout.activity);/*from w  ww. ja v a2 s.  c  om*/

    final Resources res = getResources();
    mShowAsDialog = res.getBoolean(R.bool.show_as_dialog);

    if (mShowAsDialog) {
        // backgroundDimAmount from theme isn't applied; do it manually
        final WindowManager.LayoutParams a = getWindow().getAttributes();
        a.dimAmount = 0.6f;
        getWindow().setAttributes(a);

        getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
        getWindow().setFlags(~0, WindowManager.LayoutParams.FLAG_DIM_BEHIND);

        // Inset ourselves to look like a dialog
        final Point size = new Point();
        getWindowManager().getDefaultDisplay().getSize(size);

        final int width = (int) res.getFraction(R.dimen.dialog_width, size.x, size.x);
        final int height = (int) res.getFraction(R.dimen.dialog_height, size.y, size.y);
        final int insetX = (size.x - width) / 2;
        final int insetY = (size.y - height) / 2;

        final Drawable before = getWindow().getDecorView().getBackground();
        final Drawable after = new InsetDrawable(before, insetX, insetY, insetX, insetY);
        getWindow().getDecorView().setBackground(after);

        // Dismiss when touch down in the dimmed inset area
        getWindow().getDecorView().setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    final float x = event.getX();
                    final float y = event.getY();
                    if (x < insetX || x > v.getWidth() - insetX || y < insetY || y > v.getHeight() - insetY) {
                        finish();
                        return true;
                    }
                }
                return false;
            }
        });

    } else {
        // Non-dialog means we have a drawer
        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

        mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer_glyph,
                R.string.drawer_open, R.string.drawer_close);

        mDrawerLayout.setDrawerListener(mDrawerListener);
        mDrawerLayout.setDrawerShadow(R.drawable.ic_drawer_shadow, GravityCompat.START);

        mRootsContainer = findViewById(R.id.container_roots);
    }

    mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);

    if (icicle != null) {
        mState = icicle.getParcelable(EXTRA_STATE);
    } else {
        buildDefaultState();
    }

    // Hide roots when we're managing a specific root
    if (mState.action == ACTION_MANAGE) {
        if (mShowAsDialog) {
            findViewById(R.id.dialog_roots).setVisibility(View.GONE);
        } else {
            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
        }
    }

    if (mState.action == ACTION_CREATE) {
        final String mimeType = getIntent().getType();
        final String title = getIntent().getStringExtra(Intent.EXTRA_TITLE);
        SaveFragment.show(getFragmentManager(), mimeType, title);
    }

    if (mState.action == ACTION_GET_CONTENT) {
        final Intent moreApps = new Intent(getIntent());
        moreApps.setComponent(null);
        moreApps.setPackage(null);
        RootsFragment.show(getFragmentManager(), moreApps);
    } else if (mState.action == ACTION_OPEN || mState.action == ACTION_CREATE) {
        RootsFragment.show(getFragmentManager(), null);
    }

    if (!mState.restored) {
        if (mState.action == ACTION_MANAGE) {
            final Uri rootUri = getIntent().getData();
            new RestoreRootTask(rootUri).executeOnExecutor(getCurrentExecutor());
        } else {
            new RestoreStackTask().execute();
        }
    } else {
        onCurrentDirectoryChanged(ANIM_NONE);
    }
}

From source file:org.tunesremote.ArtistsListFragment.java

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
    try {//from www  .j  a v  a 2s .  c o  m
        Response resp = (Response) adapter.getItem(position);
        final String artist = resp.getString("mlit");

        Intent intent = new Intent(host, AlbumsActivity.class);
        intent.putExtra(Intent.EXTRA_TITLE, artist);
        host.startActivityForResult(intent, 1);
    } catch (Exception e) {
        Log.w(TAG, "onItemClick:" + e.getMessage());
    }
}