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.sonetel.plugins.sonetelcallback.CallBack.java

@Override
public void onReceive(final Context context, Intent intent) {
    if (SipManager.ACTION_GET_PHONE_HANDLERS.equals(intent.getAction())) {
        // Retrieve and cache infos from the phone app 
        if (!sPhoneAppInfoLoaded) {
            Resources r = context.getResources();
            BitmapDrawable drawable = (BitmapDrawable) r.getDrawable(R.drawable.ic_wizard_sonetel);
            sPhoneAppBmp = drawable.getBitmap();

            sPhoneAppInfoLoaded = true;//from w w  w.j  a va 2s. com
        }

        Bundle results = getResultExtras(true);
        //if(pendingIntent != null) {
        //   results.putParcelable(CallHandlerPlugin.EXTRA_REMOTE_INTENT_TOKEN, pendingIntent);
        //}
        results.putString(Intent.EXTRA_TITLE, "Call back");// context.getResources().getString(R.string.use_pstn));
        if (sPhoneAppBmp != null) {
            results.putParcelable(Intent.EXTRA_SHORTCUT_ICON, sPhoneAppBmp);
        }
        if (intent.getStringExtra(Intent.EXTRA_TEXT) == null)
            return;

        final String dialledNum = intent.getStringExtra(Intent.EXTRA_TEXT);
        final String callthrunum = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
        DBAdapter dbAdapt = new DBAdapter(context);

        // Build pending intent

        SipAccount = dbAdapt.getAccount(1);

        if (SipAccount != null) {

            //Intent i = new Intent(Intent.ACTION_CALL);
            //i.setData(Uri.fromParts("tel", callthrunum, null));
            //final PendingIntent pendingIntent  = PendingIntent.getActivity(context, 0, i,  PendingIntent.FLAG_CANCEL_CURRENT);

            NetWorkThread = new Thread() {
                public void run() {
                    SendMsgToNetWork(dialledNum, callthrunum, context, null);
                };
            };

            NetWorkThread.start();

        } else if (SipAccount.acc_id != "1")
            Toast.makeText(context, "Unable to find Sonetel account. Please sign in using your Sonetel account",
                    Toast.LENGTH_LONG).show();

        if (!dialledNum.equalsIgnoreCase("")) {
            SipCallSessionImpl callInfo = new SipCallSessionImpl();

            callInfo.setRemoteContact(dialledNum);
            callInfo.setIncoming(false);
            callInfo.callStart = System.currentTimeMillis();
            callInfo.setAccId(4);
            //callInfo.setLastStatusCode(pjsua.PJ_SUCCESS);

            ContentValues cv = CallLogHelper.logValuesForCall(context, callInfo, callInfo.callStart);
            context.getContentResolver().insert(SipManager.CALLLOG_URI, cv);

        }
        //}
        //else
        //{

        //}
    }

    // This will exclude next time tel:xxx is raised from csipsimple treatment which is wanted
    //results.putString(Intent.EXTRA_PHONE_NUMBER, callthrunum);

}

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

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    final Cursor cursor = (Cursor) mAdapter.getItem(position);
    final String trackId;
    final String trackName;
    final int trackColor;

    if (cursor != null) {
        trackId = cursor.getString(TracksAdapter.TracksQuery.TRACK_ID);
        trackName = cursor.getString(TracksAdapter.TracksQuery.TRACK_NAME);
        trackColor = cursor.getInt(TracksAdapter.TracksQuery.TRACK_COLOR);
    } else {//from w  w w . ja v  a  2s  .co m
        trackId = CfpContract.Tracks.ALL_TRACK_ID;
        trackName = null;
        trackColor = -1;
    }

    AnalyticsUtils.getInstance(getActivity()).trackEvent("Tracks", "Click",
            trackName != null ? trackName : "All Sessions", 0);

    final Intent intent = new Intent(Intent.ACTION_VIEW);
    final Uri trackUri = CfpContract.Tracks.buildTrackUri(trackId);
    intent.putExtra(SessionsFragment.EXTRA_TRACK, trackUri);
    intent.putExtra(Intent.EXTRA_TITLE, trackName);
    intent.putExtra(SessionsFragment.EXTRA_TRACK_COLOR, trackColor);

    if (cursor == null) {
        intent.setData(CfpContract.Sessions.CONTENT_URI);
    } else {
        intent.setData(CfpContract.Tracks.buildSessionsUri(trackId));
    }

    ((BaseActivity) getActivity()).openActivityOrFragment(intent);

    if (UIUtils.isHoneycombTablet(getActivity())) {
        getListView().setItemChecked(position, true);
    }
}

From source file:com.github.chenxiaolong.dualbootpatcher.FileUtils.java

private static void setCommonSaveOptions(Intent intent, String mimeType, String defaultName) {
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType(mimeType);/*w  ww.j a  v a  2s .  c o m*/
    intent.putExtra(Intent.EXTRA_TITLE, defaultName);
}

From source file:jlelse.simplewebwrapper.SimpleWebWrapperActivity.java

private void enableFabChanges() {
    if (isShareFab()) {
        setFabEnabled(true);/*from w  w w .  j  a va  2s  . co m*/
        setFabDrawable(ContextCompat.getDrawable(this, R.drawable.ic_share_white_24dp));
        setFabListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                sendIntent.putExtra(Intent.EXTRA_TITLE, webView.getTitle());
                sendIntent.putExtra(Intent.EXTRA_TEXT, getCurrentUrl());
                sendIntent.setType("text/plain");
                startActivity(sendIntent);
            }
        });
    } else {
        setFabEnabled(false);
    }
}

From source file:com.vrem.wifianalyzer.navigation.items.ExportItem.java

private Intent createIntent(String title, String data) {
    Intent intent = createSendIntent();/*from  ww w  .  j  ava 2  s . co m*/
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TITLE, title);
    intent.putExtra(Intent.EXTRA_SUBJECT, title);
    intent.putExtra(Intent.EXTRA_TEXT, data);
    return intent;
}

From source file:com.android.settings.SettingsLicenseActivity.java

private void showHtmlFromUri(Uri uri) {
    // Kick off external viewer due to WebView security restrictions; we
    // carefully point it at HTMLViewer, since it offers to decompress
    // before viewing.
    final Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(uri, "text/html");
    intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.settings_license_activity_title));
    if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    }//from ww  w . jav a2  s.c o  m
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setPackage("com.android.htmlviewer");

    try {
        startActivity(intent);
        finish();
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "Failed to find viewer", e);
        showErrorAndFinish();
    }
}

From source file:org.tunesremote.PlaylistsFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {

    final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

    try {//from  w w  w  .  j av a2 s .co  m
        // create context menu to play entire artist
        final Playlist ply = (Playlist) adapter.getItem(info.position);
        menu.setHeaderTitle(ply.getName());
        final String playlistid = Long.toString(ply.getID());

        final MenuItem browse = menu.add(R.string.albums_menu_browse);
        browse.setOnMenuItemClickListener(new OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
                Intent intent = new Intent(host, TracksActivity.class);
                intent.putExtra(Intent.EXTRA_TITLE, "");
                intent.putExtra("Playlist", playlistid);
                intent.putExtra("PlaylistPersistentId", ply.getPersistentId());
                intent.putExtra("AllAlbums", false);
                host.startActivityForResult(intent, 1);

                return true;
            }

        });

        final MenuItem play = menu.add(R.string.playlists_menu_play);
        play.setOnMenuItemClickListener(new OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
                host.session.controlPlayPlaylist(ply.getPersistentId(), "0");
                host.finish();
                return true;
            }

        });
    } catch (Exception e) {
        Log.w(TAG, "onCreateContextMenu:" + e.getMessage());
    }

}

From source file:de.j4velin.encrypter.EncryptedFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, final Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == REQUEST_OUTPUT) {
            String expectedFilename;
            if (data.hasExtra(Intent.EXTRA_TITLE)) {
                expectedFilename = data.getStringExtra(Intent.EXTRA_TITLE);
            } else {
                expectedFilename = selectedFile.name;
            }/*from  w  w  w .  j a  v a2s  .  co  m*/
            try {
                CryptoUtil.decrypt(getContext(), selectedFile, data.getData(), expectedFilename);
            } catch (GeneralSecurityException e) {
                Snackbar.make(((MainActivity) getActivity()).getCoordinatorLayout(),
                        getString(R.string.error_security, e.getMessage()), Snackbar.LENGTH_LONG).show();
            } catch (FileNotFoundException e) {
                Snackbar.make(((MainActivity) getActivity()).getCoordinatorLayout(),
                        R.string.error_file_not_found, Snackbar.LENGTH_LONG).show();
            } catch (IOException e) {
                Snackbar.make(((MainActivity) getActivity()).getCoordinatorLayout(),
                        getString(R.string.error_io, e.getMessage()), Snackbar.LENGTH_LONG).show();
            }
        }
    }
}

From source file:org.deviceconnect.android.client.activity.FragmentPagerActivity.java

/**
 * ?.//from   ww w. ja v  a 2  s. co m
 * @param view 
 */
protected void onDrawerClosed(final View view) {
    invalidateOptionsMenu();

    Fragment fragment = ((FragmentViewPager) findViewById(R.id.activity_main_pager)).getCurrentFragment();
    if (fragment != null && ((Fragment) fragment).getArguments() != null) {
        getActionBar().setTitle(fragment.getArguments().getString(Intent.EXTRA_TITLE, fragment.toString()));
    } else if (fragment != null) {
        getActionBar().setTitle(fragment.toString());
    } else {
        getActionBar().setTitle(R.string.app_name);
    }
}

From source file:com.csipsimple.plugins.twvoip.CallHandler.java

@Override
public void onReceive(Context context, Intent intent) {
    if (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_12VOIP_USER, "");
        String pwd = prefs.getString(CallHandlerConfig.KEY_12VOIP_PWD, "");
        String nbr = prefs.getString(CallHandlerConfig.KEY_12VOIP_NBR, "");

        // 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)) {
            // Build pending intent
            Intent i = new Intent(ACTION_DO_TWVOIP_CALL);
            i.setClass(context, getClass());
            i.putExtra(Intent.EXTRA_PHONE_NUMBER, number);

            pendingIntent = PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT);
            // = PendingIntent.getActivity(context, 0, i, 0);
        }//w  w w .jav  a 2  s.c om

        // Build icon
        Bitmap bmp = null;
        Drawable icon = context.getResources().getDrawable(R.drawable.icon);
        BitmapDrawable bd = ((BitmapDrawable) icon);
        bmp = bd.getBitmap();

        // Build the result for the row (label, icon, pending intent, and
        // excluded phone number)
        Bundle results = getResultExtras(true);
        if (pendingIntent != null) {
            results.putParcelable(Intent.EXTRA_REMOTE_INTENT_TOKEN, pendingIntent);
        }
        results.putString(Intent.EXTRA_TITLE, "12voip WebCallback");
        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_TWVOIP_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_12VOIP_USER, "");
        String pwd = prefs.getString(CallHandlerConfig.KEY_12VOIP_PWD, "");
        String nbr = prefs.getString(CallHandlerConfig.KEY_12VOIP_NBR, "");

        // 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.12voip.com//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());
        }

    }
}