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.gdgdevfest.android.apps.devfestbcn.ui.tablet.SessionsSandboxMultiPaneActivity.java

private void routeIntent(Intent intent, boolean updateSurfaceOnly) {
    Uri uri = intent.getData();/*from w  w w  .  j  a  v  a2 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);
            getSupportActionBar().setSelectedNavigationItem(defaultViewType);
            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);
            }
        }

    } else if (ScheduleContract.Sandbox.CONTENT_TYPE.equals(mimeType)) {
        // Load a sandbox company list
        mViewType = TracksDropdownFragment.VIEW_TYPE_SANDBOX;
        showFullUI(false);
        if (!updateSurfaceOnly) {
            loadSandboxList(uri, null);
            mSlidingPaneLayout.openPane();
        }

    } else if (ScheduleContract.Sandbox.CONTENT_ITEM_TYPE.equals(mimeType)) {
        // Load company details
        mViewType = TracksDropdownFragment.VIEW_TYPE_SANDBOX;
        showFullUI(false);
        if (!updateSurfaceOnly) {
            Uri masterUri = intent.getParcelableExtra(EXTRA_MASTER_URI);
            if (masterUri == null) {
                masterUri = ScheduleContract.Sandbox.CONTENT_URI;
            }
            loadSandboxList(masterUri, ScheduleContract.Sandbox.getCompanyId(uri));
            loadSandboxDetail(uri);
        }
    }

    updateDetailBackground();
}

From source file:org.tunesremote.AllAlbumsListFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {

    int id = item.getItemId();
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();

    try {//from  www.  ja  v  a  2s.  com
        final Response resp = (Response) adapter.getItem(info.position);
        final String albumid = resp.getNumberString("mper");

        if (id == R.id.context_album_play) {
            host.session.controlPlayAlbum(albumid, 0);
            host.setResult(Activity.RESULT_OK, new Intent());
            host.finish();
            return true;
        } else if (id == R.id.context_album_queue) {
            host.session.controlQueueAlbum(albumid);
            host.setResult(Activity.RESULT_OK, new Intent());
            host.finish();
            return true;
        } else if (id == R.id.context_album_browse) {
            Intent intent = new Intent(host, TracksActivity.class);
            intent.putExtra(Intent.EXTRA_TITLE, albumid);
            intent.putExtra("minm", resp.getString("minm"));
            intent.putExtra("miid", Long.valueOf(resp.getNumberLong("miid")).intValue());
            intent.putExtra("Artist", resp.getString("asaa"));
            intent.putExtra("AllAlbums", false);
            host.startActivityForResult(intent, 1);
            return true;
        }
    } catch (Exception ex) {
        Log.w(TAG, "onContextItemSelected: " + ex.getMessage());
    }

    return super.onContextItemSelected(item);
}

From source file:net.naonedbus.card.Card.java

private void showMoreAction() {
    final Intent moreIntent = getMoreIntent();
    if (moreIntent != null) {

        final int title = moreIntent.getIntExtra(Intent.EXTRA_TITLE, 0);
        if (title != 0) {
            mMoreActionView.setText(title);
        }//from www. ja  v  a 2  s  .  c  om

        final int icon = moreIntent.getIntExtra(Intent.EXTRA_SHORTCUT_ICON, 0);
        if (icon != 0) {
            mMoreActionView.setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
        }

        mMoreActionView.setVisibility(View.VISIBLE);
        mMoreActionView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(final View v) {
                mContext.startActivity(moreIntent);
            }
        });

    }
}

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

/** {@inheritDoc} */
@Override/*from ww  w .j  av  a 2  s . c  o m*/
public void onListItemClick(ListView l, View v, int position, long id) {
    // Launch viewer for specific session, passing along any track knowledge
    // that should influence the title-bar.
    final Cursor cursor = (Cursor) mAdapter.getItem(position);
    final String sessionId = cursor.getString(SessionsQuery.SESSION_ID);
    final String title = cursor.getString(SessionsQuery.SESSION_TITLE);
    AnalyticsUtils.getInstance(getActivity()).trackEvent("Sessions", "Click", title, 0);
    getListView().setItemChecked(position, true);
    mCheckedPosition = position;
    final Uri sessionUri = CfpContract.Sessions.buildSessionUri(sessionId);
    final Intent intent = new Intent(Intent.ACTION_VIEW, sessionUri);
    intent.putExtra(Intent.EXTRA_TITLE, mTrackName);
    intent.putExtra(SessionDetailFragment.EXTRA_TRACK_COLOR, mTrackColor);
    ((BaseActivity) getSupportActivity()).openActivityOrFragment(intent);
}

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

/** {@inheritDoc} */
@Override/*w w w. j  a v a 2  s .c om*/
public void onListItemClick(ListView l, View v, int position, long id) {
    // Launch viewer for specific session, passing along any track knowledge
    // that should influence the title-bar.
    final Cursor cursor = (Cursor) mAdapter.getItem(position);
    final String sessionId = cursor.getString(SessionsQuery.SESSION_ID);
    final String title = cursor.getString(SessionsQuery.SESSION_TITLE);
    AnalyticsUtils.getInstance(getActivity()).trackEvent("Sessions", "Click", title, 0);
    if (UIUtils.isHoneycombTablet(getActivity())) {
        getListView().setItemChecked(position, true);
        mCheckedPosition = position;
    }
    final Uri sessionUri = CfpContract.Sessions.buildSessionUri(sessionId);
    final Intent intent = new Intent(Intent.ACTION_VIEW, sessionUri);
    intent.putExtra(Intent.EXTRA_TITLE, mTrackName);
    intent.putExtra(SessionDetailFragment.EXTRA_TRACK_COLOR, mTrackColor);
    ((BaseActivity) getActivity()).openActivityOrFragment(intent);
}

From source file:org.tunesremote.AllAlbumsListFragment.java

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
    try {//from  w w w  . ja  va2  s .co m
        // launch activity to browse track details for this albums
        final Response resp = (Response) adapter.getItem(i);
        final String albumid = resp.getNumberString("mper");

        Intent intent = new Intent(host, TracksActivity.class);
        intent.putExtra(Intent.EXTRA_TITLE, albumid);
        intent.putExtra("minm", resp.getString("minm"));
        intent.putExtra("miid", Long.valueOf(resp.getNumberLong("miid")).intValue());
        intent.putExtra("Artist", resp.getString("asaa"));
        intent.putExtra("AllAlbums", false);
        startActivityForResult(intent, 1);
    } catch (Exception e) {
        Log.w(TAG, "onCreate:" + e.getMessage());
    }
}

From source file:net.mypapit.mobile.callsignview.CallsignDetailActivity.java

private void setShareIntent() {
    if (mShareActionProvider != null) {
        Intent intent = new Intent(android.content.Intent.ACTION_SEND);
        intent.setType("text/plain");

        intent.putExtra(Intent.EXTRA_SUBJECT, "Callsign: " + csinfo.getCallsign());
        intent.putExtra(Intent.EXTRA_TITLE, "Callsign: " + csinfo.getCallsign());
        intent.putExtra(Intent.EXTRA_TEXT, "Callsign: " + csinfo.getCallsign() + "\nHandle: "
                + csinfo.getHandle() + "\nAA: " + csinfo.getAa() + "\nExpiry: " + csinfo.getExpire() + "\n");

        mShareActionProvider.setShareIntent(intent);
    }/*from   w  ww  .ja  v a  2 s.com*/

}

From source file:com.github.dfa.diaspora_android.activity.ShareActivity.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*w ww  .ja v  a  2  s  . c  om*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main__activity);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (toolbar != null) {
        toolbar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (Helpers.isOnline(ShareActivity.this)) {
                    Intent intent = new Intent(ShareActivity.this, MainActivity.class);
                    startActivityForResult(intent, 100);
                    overridePendingTransition(0, 0);
                    finish();
                } else {
                    Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show();
                }
            }
        });
    }
    setTitle(R.string.new_post);

    progressBar = (ProgressBar) findViewById(R.id.progressBar);

    swipeView = (SwipeRefreshLayout) findViewById(R.id.swipe);
    swipeView.setEnabled(false);

    podDomain = ((App) getApplication()).getSettings().getPodDomain();

    webView = (WebView) findViewById(R.id.webView);
    webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);

    WebSettings wSettings = webView.getSettings();
    wSettings.setJavaScriptEnabled(true);
    wSettings.setBuiltInZoomControls(true);

    if (Build.VERSION.SDK_INT >= 21)
        wSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);

    /*
     * WebViewClient
     */
    webView.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Log.d(TAG, url);
            if (!url.contains(podDomain)) {
                Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                startActivity(i);
                return true;
            }
            return false;

        }

        public void onPageFinished(WebView view, String url) {
            Log.i(TAG, "Finished loading URL: " + url);
        }
    });

    /*
     * WebChromeClient
     */
    webView.setWebChromeClient(new WebChromeClient() {

        public void onProgressChanged(WebView wv, int progress) {
            progressBar.setProgress(progress);

            if (progress > 0 && progress <= 60) {
                Helpers.getNotificationCount(wv);
            }

            if (progress > 60) {
                Helpers.applyDiasporaMobileSiteChanges(wv);
            }

            if (progress == 100) {
                progressBar.setVisibility(View.GONE);
            } else {
                progressBar.setVisibility(View.VISIBLE);
            }
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                FileChooserParams fileChooserParams) {
            if (mFilePathCallback != null)
                mFilePathCallback.onReceiveValue(null);

            mFilePathCallback = filePathCallback;

            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
                // Create the File where the photo should go
                File photoFile = null;
                try {
                    photoFile = createImageFile();
                    takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
                } catch (IOException ex) {
                    // Error occurred while creating the File
                    Snackbar.make(getWindow().findViewById(R.id.main__layout), "Unable to get image",
                            Snackbar.LENGTH_LONG).show();
                }

                // Continue only if the File was successfully created
                if (photoFile != null) {
                    mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
                    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
                } else {
                    takePictureIntent = null;
                }
            }

            Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
            contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
            contentSelectionIntent.setType("image/*");

            Intent[] intentArray;
            if (takePictureIntent != null) {
                intentArray = new Intent[] { takePictureIntent };
            } else {
                intentArray = new Intent[0];
            }

            Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
            chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
            chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
            chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);

            startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);

            return true;
        }
    });

    if (savedInstanceState == null) {
        if (Helpers.isOnline(ShareActivity.this)) {
            webView.loadUrl("https://" + podDomain + "/status_messages/new");
        } else {
            Snackbar.make(getWindow().findViewById(R.id.main__layout), R.string.no_internet,
                    Snackbar.LENGTH_LONG).show();
        }
    }

    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            if (intent.hasExtra(Intent.EXTRA_SUBJECT)) {
                handleSendSubject(intent);
            } else {
                handleSendText(intent);
            }
        } else if (type.startsWith("image/")) {
            // TODO Handle single image being sent -> see manifest
            handleSendImage(intent);
        }
        //} else {
        // Handle other intents, such as being started from the home screen
    }

}

From source file:com.github.dfa.diaspora_android.activity.ShareActivity2.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*  w  w w  . j a v a2 s . c o  m*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    progressBar = (ProgressBar) findViewById(R.id.progressBar);

    swipeView = (SwipeRefreshLayout) findViewById(R.id.swipe);
    swipeView.setEnabled(false);

    toolbar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (Helpers.isOnline(ShareActivity2.this)) {
                Intent intent = new Intent(ShareActivity2.this, MainActivity.class);
                startActivityForResult(intent, 100);
                overridePendingTransition(0, 0);
            } else {
                Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show();
            }
        }
    });

    podDomain = ((App) getApplication()).getSettings().getPodDomain();

    fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.fab_expand_menu_button);
    fab.setVisibility(View.GONE);

    webView = (WebView) findViewById(R.id.webView);
    webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);

    WebSettings wSettings = webView.getSettings();
    wSettings.setJavaScriptEnabled(true);
    wSettings.setBuiltInZoomControls(true);

    if (Build.VERSION.SDK_INT >= 21)
        wSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);

    /*
     * WebViewClient
     */
    webView.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Log.d(TAG, url);
            if (!url.contains(podDomain)) {
                Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                startActivity(i);
                return true;
            }
            return false;

        }

        public void onPageFinished(WebView view, String url) {
            Log.i(TAG, "Finished loading URL: " + url);
        }
    });

    /*
     * WebChromeClient
     */
    webView.setWebChromeClient(new WebChromeClient() {

        public void onProgressChanged(WebView wv, int progress) {
            progressBar.setProgress(progress);

            if (progress > 0 && progress <= 60) {
                Helpers.getNotificationCount(wv);
            }

            if (progress > 60) {
                Helpers.hideTopBar(wv);
            }

            if (progress == 100) {
                progressBar.setVisibility(View.GONE);
            } else {
                progressBar.setVisibility(View.VISIBLE);
            }
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                FileChooserParams fileChooserParams) {
            if (mFilePathCallback != null)
                mFilePathCallback.onReceiveValue(null);

            mFilePathCallback = filePathCallback;

            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
                // Create the File where the photo should go
                File photoFile = null;
                try {
                    photoFile = createImageFile();
                    takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
                } catch (IOException ex) {
                    // Error occurred while creating the File
                    Snackbar.make(getWindow().findViewById(R.id.drawer_layout), "Unable to get image",
                            Snackbar.LENGTH_SHORT).show();
                }

                // Continue only if the File was successfully created
                if (photoFile != null) {
                    mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
                    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
                } else {
                    takePictureIntent = null;
                }
            }

            Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
            contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
            contentSelectionIntent.setType("image/*");

            Intent[] intentArray;
            if (takePictureIntent != null) {
                intentArray = new Intent[] { takePictureIntent };
            } else {
                intentArray = new Intent[0];
            }

            Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
            chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
            chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
            chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);

            startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);

            return true;
        }
    });

    Intent intent = getIntent();
    final Bundle extras = intent.getExtras();
    String action = intent.getAction();

    if (Intent.ACTION_SEND.equals(action)) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {

                if (extras.containsKey(Intent.EXTRA_TEXT) && extras.containsKey(Intent.EXTRA_SUBJECT)) {
                    final String extraText = (String) extras.get(Intent.EXTRA_TEXT);
                    final String extraSubject = (String) extras.get(Intent.EXTRA_SUBJECT);

                    webView.setWebViewClient(new WebViewClient() {
                        @Override
                        public boolean shouldOverrideUrlLoading(WebView view, String url) {

                            finish();

                            Intent i = new Intent(ShareActivity2.this, MainActivity.class);
                            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            startActivity(i);
                            overridePendingTransition(0, 0);

                            return false;
                        }
                    });

                    webView.loadUrl("javascript:(function() { "
                            + "document.getElementsByTagName('textarea')[0].style.height='110px'; "
                            + "document.getElementsByTagName('textarea')[0].innerHTML = '**[" + extraSubject
                            + "]** " + extraText + " *[shared with #DiasporaWebApp]*'; "
                            + "    if(document.getElementById(\"main_nav\")) {"
                            + "        document.getElementById(\"main_nav\").parentNode.removeChild("
                            + "        document.getElementById(\"main_nav\"));"
                            + "    } else if (document.getElementById(\"main-nav\")) {"
                            + "        document.getElementById(\"main-nav\").parentNode.removeChild("
                            + "        document.getElementById(\"main-nav\"));" + "    }" + "})();");

                }
            }
        });
    }

    if (savedInstanceState == null) {
        if (Helpers.isOnline(ShareActivity2.this)) {
            webView.loadUrl("https://" + podDomain + "/status_messages/new");
        } else {
            Snackbar.make(getWindow().findViewById(R.id.drawer_layout), R.string.no_internet,
                    Snackbar.LENGTH_SHORT).show();
        }
    }

}

From source file:it.rignanese.leo.slimtwitter.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // setup the sharedPreferences
    savedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    setContentView(R.layout.activity_main);

    //setup the floating button
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override/*from   www.  ja va  2 s .c o  m*/
        public void onClick(View view) {
            webViewTwitter.scrollTo(0, 0);//scroll up
        }
    });

    // setup the refresh layout
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
    swipeRefreshLayout.setColorSchemeResources(R.color.officialAzureTwitter, R.color.darkAzureSlimTwitterTheme);// set the colors
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            refreshPage();//reload the page
            swipeRefresh = true;
        }
    });

    // setup the webView
    webViewTwitter = (WebView) findViewById(R.id.webView);
    setUpWebViewDefaults(webViewTwitter);//set the settings

    goHome();//load homepage

    //WebViewClient that is the client callback.
    webViewTwitter.setWebViewClient(new WebViewClient() {//advanced set up

        // when there isn't a connetion
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            String summary = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /></head><body><h1 "
                    + "style='text-align:center; padding-top:15%;'>" + getString(R.string.titleNoConnection)
                    + "</h1> <h3 style='text-align:center; padding-top:1%; font-style: italic;'>"
                    + getString(R.string.descriptionNoConnection)
                    + "</h3>  <h5 style='text-align:center; padding-top:80%; opacity: 0.3;'>"
                    + getString(R.string.awards) + "</h5></body></html>";
            webViewTwitter.loadData(summary, "text/html; charset=utf-8", "utf-8");//load a custom html page

            noConnectionError = true;
            swipeRefreshLayout.setRefreshing(false); //when the page is loaded, stop the refreshing
        }

        // when I click in a external link
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url == null || url.contains("twitter.com")) {
                //url is ok
                return false;
            } else {
                //if the link doesn't contain 'twitter.com', open it using the browser
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
                return true;
            }
        }

        //START management of loading
        @Override
        public void onPageFinished(WebView view, String url) {
            swipeRefreshLayout.setRefreshing(false); //when the page is loaded, stop the refreshing
            super.onPageFinished(view, url);
        }
        //END management of loading

    });

    //WebChromeClient for handling all chrome functions.
    webViewTwitter.setWebChromeClient(new WebChromeClient() {
        //to upload files
        //thanks to gauntface
        //https://github.com/GoogleChrome/chromium-webview-samples
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                WebChromeClient.FileChooserParams fileChooserParams) {
            if (mFilePathCallback != null) {
                mFilePathCallback.onReceiveValue(null);
            }
            mFilePathCallback = filePathCallback;

            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            if (takePictureIntent.resolveActivity(getBaseContext().getPackageManager()) != null) {
                // Create the File where the photo should go
                File photoFile = null;
                try {
                    photoFile = createImageFile();
                    takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
                } catch (IOException ex) {
                    // Error occurred while creating the File
                }

                // Continue only if the File was successfully created
                if (photoFile != null) {
                    mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
                    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
                } else {
                    takePictureIntent = null;
                }
            }

            Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
            contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
            contentSelectionIntent.setType("image/*");

            Intent[] intentArray;
            if (takePictureIntent != null) {
                intentArray = new Intent[] { takePictureIntent };
            } else {
                intentArray = new Intent[0];
            }

            Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
            chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
            chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
            chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);

            startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);

            return true;
        }
    });
}