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.csipsimple.plugins.betamax.CallHandlerWeb.java

@Override
public void onReceive(Context context, Intent intent) {
    if (Utils.ACTION_GET_PHONE_HANDLERS.equals(intent.getAction())) {

        PendingIntent pendingIntent = null;
        // Extract infos from intent received
        String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);

        // Extract infos from settings
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        String user = prefs.getString(CallHandlerConfig.KEY_TW_USER, "");
        String pwd = prefs.getString(CallHandlerConfig.KEY_TW_PWD, "");
        String nbr = prefs.getString(CallHandlerConfig.KEY_TW_NBR, "");
        String provider = prefs.getString(CallHandlerConfig.KEY_TW_PROVIDER, "");

        // We must handle that clean way cause when call just to
        // get the row in account list expect this to reply correctly
        if (!TextUtils.isEmpty(number) && !TextUtils.isEmpty(user) && !TextUtils.isEmpty(nbr)
                && !TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(provider)) {
            // Build pending intent
            Intent i = new Intent(ACTION_DO_WEB_CALL);
            i.setClass(context, getClass());
            i.putExtra(Intent.EXTRA_PHONE_NUMBER, number);
            pendingIntent = PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT);

        }/*from www. java 2s.c  o m*/

        // Build icon
        Bitmap bmp = Utils.getBitmapFromResource(context, R.drawable.icon_web);

        // Build the result for the row (label, icon, pending intent, and
        // excluded phone number)
        Bundle results = getResultExtras(true);
        if (pendingIntent != null) {
            results.putParcelable(Utils.EXTRA_REMOTE_INTENT_TOKEN, pendingIntent);
        }

        // Text for the row
        String providerName = "";
        Resources r = context.getResources();
        if (!TextUtils.isEmpty(provider)) {
            String[] arr = r.getStringArray(R.array.provider_values);
            String[] arrEntries = r.getStringArray(R.array.provider_entries);
            int i = 0;
            for (String prov : arr) {
                if (prov.equalsIgnoreCase(provider)) {
                    providerName = arrEntries[i];
                    break;
                }
                i++;
            }
        }
        results.putString(Intent.EXTRA_TITLE, providerName + " " + r.getString(R.string.web_callback));
        Log.d(THIS_FILE, "icon is " + bmp);
        if (bmp != null) {
            results.putParcelable(Intent.EXTRA_SHORTCUT_ICON, bmp);
        }

        // DO *NOT* exclude from next tel: intent cause we use a http method
        // results.putString(Intent.EXTRA_PHONE_NUMBER, number);

    } else if (ACTION_DO_WEB_CALL.equals(intent.getAction())) {

        // Extract infos from intent received
        String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);

        // Extract infos from settings
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        String user = prefs.getString(CallHandlerConfig.KEY_TW_USER, "");
        String pwd = prefs.getString(CallHandlerConfig.KEY_TW_PWD, "");
        String nbr = prefs.getString(CallHandlerConfig.KEY_TW_NBR, "");
        String provider = prefs.getString(CallHandlerConfig.KEY_TW_PROVIDER, "");

        // params
        List<NameValuePair> params = new LinkedList<NameValuePair>();
        params.add(new BasicNameValuePair("username", user));
        params.add(new BasicNameValuePair("password", pwd));
        params.add(new BasicNameValuePair("from", nbr));
        params.add(new BasicNameValuePair("to", number));
        String paramString = URLEncodedUtils.format(params, "utf-8");

        String requestURL = "https://www." + provider + "/myaccount/makecall.php?" + paramString;

        HttpClient httpClient = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(requestURL);

        // Create a response handler
        HttpResponse httpResponse;
        try {
            httpResponse = httpClient.execute(httpGet);
            Log.d(THIS_FILE, "response code is " + httpResponse.getStatusLine().getStatusCode());
            if (httpResponse.getStatusLine().getStatusCode() == 200) {
                InputStreamReader isr = new InputStreamReader(httpResponse.getEntity().getContent());
                BufferedReader br = new BufferedReader(isr);

                String line;
                String fullReply = "";
                boolean foundSuccess = false;
                while ((line = br.readLine()) != null) {
                    if (!TextUtils.isEmpty(line) && line.toLowerCase().contains("success")) {
                        showToaster(context, "Success... wait a while you'll called back");
                        foundSuccess = true;
                        break;
                    }
                    if (!TextUtils.isEmpty(line)) {
                        fullReply = fullReply.concat(line);
                    }
                }
                if (!foundSuccess) {
                    showToaster(context, "Error : server error : " + fullReply);
                }
            } else {
                showToaster(context, "Error : invalid request " + httpResponse.getStatusLine().getStatusCode());
            }
        } catch (ClientProtocolException e) {
            showToaster(context, "Error : " + e.getLocalizedMessage());
        } catch (IOException e) {
            showToaster(context, "Error : " + e.getLocalizedMessage());
        }

    }
}

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

private void setupDuring() {
    // Conference in progress, show "Now Playing" link.
    View view = getActivity().getLayoutInflater().inflate(R.layout.whats_on_now_playing, mRootView, false);
    view.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            AnalyticsUtils.getInstance(getActivity()).trackEvent("Home Screen Dashboard", "Click",
                    "Now Playing", 0);
            if (UIUtils.isHoneycombTablet(getActivity())) {
                startActivity(new Intent(getActivity(), NowPlayingMultiPaneActivity.class));
            } else {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(//  w  w w.j a v  a 2  s  .com
                        CfpContract.Sessions.buildSessionsAtDirUri(UIUtils.getCurrentTime(getActivity())));
                intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.title_now_playing));
                startActivity(intent);
            }
        }
    });
    mRootView.addView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

From source file:org.fitchfamily.android.wifi_backend.ui.MainSettingsFragment.java

@AfterPreferences
protected void init() {
    statistic = findPreference("db_size_preference");
    changedStat = findPreference("db_change_preference");
    permission = findPreference("grant_permission");
    final Preference exportAll = findPreference("db_export");
    final Preference exportChanged = findPreference("db_export_changed");
    final Preference importPref = findPreference("db_import");

    permission.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override/*  w  ww  .j  a  v a  2s  .co  m*/
        public boolean onPreferenceClick(Preference preference) {
            requestPermission();
            return false;
        }
    });

    statistic.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Configuration.listOption(Configuration.LIST_OPTION_ALL);
            WifiListActivity_.intent(getActivity()).start();
            return true;
        }
    });

    changedStat.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Configuration.listOption(Configuration.LIST_OPTION_CHANGED);
            WifiListActivity_.intent(getActivity()).start();
            return true;
        }
    });

    exportAll.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                Configuration.exportOption(Configuration.EXPORT_OPTION_ALL);
                startActivityForResult(
                        new Intent(Intent.ACTION_CREATE_DOCUMENT).setType("text/comma-separated-values")
                                .addCategory(Intent.CATEGORY_OPENABLE).putExtra(Intent.EXTRA_TITLE, "wifi.csv"),
                        EXPORT_REQUEST_CODE);
            }
            return true;
        }
    });

    exportChanged.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                Configuration.exportOption(Configuration.EXPORT_OPTION_CHANGED);
                startActivityForResult(
                        new Intent(Intent.ACTION_CREATE_DOCUMENT).setType("text/comma-separated-values")
                                .addCategory(Intent.CATEGORY_OPENABLE).putExtra(Intent.EXTRA_TITLE, "wifi.csv"),
                        EXPORT_REQUEST_CODE);
            }
            return true;
        }
    });

    importPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT)
                        .setType("text/comma-separated-values").addCategory(Intent.CATEGORY_OPENABLE),
                        IMPORT_REQUEST_CODE);
            }

            return true;
        }
    });

    getLoaderManager().initLoader(0, null, new LoaderManager.LoaderCallbacks<DatabaseStatistic>() {
        @Override
        public Loader<DatabaseStatistic> onCreateLoader(int i, Bundle bundle) {
            return new DatabaseStatisticLoader(getActivity());
        }

        @Override
        public void onLoadFinished(Loader<DatabaseStatistic> loader, DatabaseStatistic databaseStatistic) {
            setRecords(databaseStatistic.accessPointCount());
            setChangedStat(databaseStatistic.accessPointChangeCount());
        }

        @Override
        public void onLoaderReset(Loader<DatabaseStatistic> loader) {
            setRecords(0);
            setChangedStat(0);
        }
    });

    checkPermission();
}

From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.SessionsFragment.java

public void reloadFromArguments(Bundle arguments, boolean reset) {
    mCheckedPosition = -1;/*from ww  w.j a  v  a  2s.  c om*/

    // Load new arguments
    final Intent intent = ActivityHelper.fragmentArgumentsToIntent(arguments);
    mSessionsUri = intent.getData();
    if (mSessionsUri == null) {
        return;
    }

    mNewSessionTimestamp = intent.getLongExtra(NewSessionsActivity.EXTRA_NEW_SESSION_TIMESTAMP, -1);

    final int sessionsQueryId;
    if (!CfpContract.Sessions.isSearchUri(mSessionsUri)) {
        mAdapter = new SessionsAdapter(getActivity(), null);
        sessionsQueryId = SessionsQuery._TOKEN;
    } else {
        mAdapter = new SearchAdapter(getActivity(), null);
        sessionsQueryId = SearchQuery._TOKEN;
    }

    setListAdapter(mAdapter);

    if (!reset) {
        getLoaderManager().initLoader(sessionsQueryId, null, mSessionsLoaderCallback);
    } else {
        getLoaderManager().restartLoader(sessionsQueryId, null, mSessionsLoaderCallback);
    }

    mTrackName = intent.getStringExtra(Intent.EXTRA_TITLE);
    mTrackColor = intent.getIntExtra(EXTRA_TRACK_COLOR, -1);
    final Uri trackUri = intent.getParcelableExtra(SessionsFragment.EXTRA_TRACK);
    if (!TextUtils.isEmpty(mTrackName)) {
        AnalyticsUtils.getInstance(getActivity()).trackPageView("/Sessions/" + mTrackName);
        updateTrackData();
    }
    if (TextUtils.isEmpty(mTrackName) && mTrackColor == -1 && trackUri != null) {
        Bundle args = new Bundle();
        args.putParcelable("uri", trackUri);
        getLoaderManager().initLoader(TracksQuery._TOKEN, args, mTrackLoaderCallback);
    }
}

From source file:com.wit.android.support.content.intent.ShareIntent.java

/**
 *//*from  w w  w  .  jav a2  s .  c  o m*/
@Nullable
@Override
public Intent buildIntent() {
    if (TextUtils.isEmpty(mDataType)) {
        Log.e(TAG, "Can not to create SHARE intent. Missing MIME type.");
        return null;
    }
    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, mUris);
    }
    return intent;
}

From source file:net.naonedbus.card.impl.HoraireCard.java

@Override
protected Intent getMoreIntent() {
    final Intent intent = new Intent(getContext(), HorairesActivity.class);
    intent.putExtra(HorairesActivity.PARAM_ARRET, mArret);
    intent.putExtra(Intent.EXTRA_TITLE, R.string.card_more_horaires);
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, R.drawable.ic_card_list);
    return intent;
}

From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.SessionDetailFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (mSessionUri == null) {
        return;/*from ww  w  . ja v  a2  s.c  om*/
    }

    final Intent intent = ActivityHelper.fragmentArgumentsToIntent(getArguments());
    mSessionUri = intent.getData();
    mTrackName = intent.getStringExtra(Intent.EXTRA_TITLE);
    mTrackColor = intent.getIntExtra(EXTRA_TRACK_COLOR, -1);

    if (TextUtils.isEmpty(mTrackName) || mTrackColor == -1) {
        final Uri trackUri = Sessions.buildTracksDirUri(mSessionId);
        Bundle args = new Bundle();
        args.putParcelable("uri", trackUri);
        getLoaderManager().initLoader(TracksQuery._TOKEN, args, mTrackLoaderCallback);
    } else {
        updateTrackData();
    }

    mAdapter = new SessionDetailPagerAdapter(getActivity(), getFragmentManager());
    mViewPager.setAdapter(mAdapter);
    mTabs.setAdapter(mAdapter);
    mViewPager.setOnPageChangeListener(mTabs);

    mQueryHandler = new NotifyingAsyncQueryHandler(getActivity().getContentResolver(), null);
}

From source file:com.heneryh.aquanotes.ui.WhatsOnFragment.java

private void setupDuring() {
    // Conference in progress, show "Now Playing" link.
    View view = getActivity().getLayoutInflater().inflate(R.layout.whats_on_now_playing, mRootView, false);
    view.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            if (UIUtils.isHoneycombTablet(getActivity())) {
                startActivity(new Intent(getActivity(), NowPlayingMultiPaneActivity.class));
            } else {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(AquaNotesDbContract.Sessions.buildSessionsAtDirUri(System.currentTimeMillis()));
                intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.title_now_playing));
                startActivity(intent);/*from   ww  w . j  av a 2 s .  c o  m*/
            }
        }
    });
    mRootView.addView(view);
}

From source file:com.uphyca.kitkat.storage.ui.MainFragment.java

/**
 * ??/*  w  ww .ja v  a2 s .c  o m*/
 */
@OnClick(R.id.button_mkdir)
void onMkdirButtonClick() {
    String fileName = String.format("folder-%d", new SecureRandom().nextInt());
    Intent intent = new Intent().setAction(Intent.ACTION_CREATE_DOCUMENT).addCategory(Intent.CATEGORY_OPENABLE)
            .setType(DocumentsContract.Document.MIME_TYPE_DIR).putExtra(Intent.EXTRA_TITLE, fileName);
    startActivityForResult(intent, REQUEST_MKDIR);
}

From source file:com.conferenceengineer.android.iosched.ui.tablet.SessionsSandboxMultiPaneActivity.java

private void routeIntent(Intent intent, boolean updateSurfaceOnly) {
    Uri uri = intent.getData();//  w  ww  . ja  va 2  s .  c o  m
    if (uri == null) {
        return;
    }

    if (intent.hasExtra(Intent.EXTRA_TITLE)) {
        setTitle(intent.getStringExtra(Intent.EXTRA_TITLE));
    }

    String mimeType = getContentResolver().getType(uri);

    if (ScheduleContract.Tracks.CONTENT_ITEM_TYPE.equals(mimeType)) {
        // Load track details
        showFullUI(true);
        if (!updateSurfaceOnly) {
            // TODO: don't assume the URI will contain the track ID
            int defaultViewType = intent.getIntExtra(EXTRA_DEFAULT_VIEW_TYPE,
                    TracksDropdownFragment.VIEW_TYPE_SESSIONS);
            String selectedTrackId = ScheduleContract.Tracks.getTrackId(uri);
            loadTrackList(defaultViewType, selectedTrackId);
            onTrackSelected(selectedTrackId);
            mSlidingPaneLayout.openPane();
        }

    } else if (ScheduleContract.Sessions.CONTENT_TYPE.equals(mimeType)) {
        // Load a session list, hiding the tracks dropdown and the tabs
        mViewType = TracksDropdownFragment.VIEW_TYPE_SESSIONS;
        showFullUI(false);
        if (!updateSurfaceOnly) {
            loadSessionList(uri, null);
            mSlidingPaneLayout.openPane();
        }

    } else if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals(mimeType)) {
        // Load session details
        if (intent.hasExtra(EXTRA_MASTER_URI)) {
            mViewType = TracksDropdownFragment.VIEW_TYPE_SESSIONS;
            showFullUI(false);
            if (!updateSurfaceOnly) {
                loadSessionList((Uri) intent.getParcelableExtra(EXTRA_MASTER_URI),
                        ScheduleContract.Sessions.getSessionId(uri));
                loadSessionDetail(uri);
            }
        } else {
            mViewType = TracksDropdownFragment.VIEW_TYPE_SESSIONS; // prepare for onTrackInfo...
            showFullUI(true);
            if (!updateSurfaceOnly) {
                loadSessionDetail(uri);
                loadTrackInfoFromSessionUri(uri);
            }
        }

    }

    updateDetailBackground();
}