Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

In this page you can find the example usage for android.graphics Color BLACK.

Prototype

int BLACK

To view the source code for android.graphics Color BLACK.

Click Source Link

Usage

From source file:com.amaze.filemanager.fragments.ProcessViewer.java

public void processExtractResults(DataPackage dataPackage) {
    if (!running)
        return;/*from  ww  w .j a va 2  s.c  o  m*/
    if (getResources() == null)
        return;
    final int id = dataPackage.getId();

    if (!CancelledExtractIds.contains(id)) {
        if (ExtractIds.contains(id)) {

            boolean completed = dataPackage.isCompleted();
            View process = rootView.findViewWithTag("extract" + id);
            if (completed) {
                rootView.removeViewInLayout(process);
                ExtractIds.remove(ExtractIds.indexOf(id));
            } else {
                String name = dataPackage.getName();
                int p1 = dataPackage.getP1();
                long p3 = dataPackage.getTotal();
                long p2 = dataPackage.getDone();
                ProgressBar p = (ProgressBar) process.findViewById(R.id.progressBar1);
                if (p1 <= 100) {
                    ((TextView) process.findViewById(R.id.progressText)).setText(
                            utils.getString(getActivity(), R.string.extracting) + "\n" + name + "\n" + p1 + "%"
                                    + "\n" + utils.readableFileSize(p2) + "/" + utils.readableFileSize(p3));

                    p.setProgress(p1);
                }
            }
        } else {
            CardView root = (CardView) getActivity().getLayoutInflater().inflate(R.layout.processrow, null);
            root.setTag("extract" + id);

            ImageView progressImage = ((ImageView) root.findViewById(R.id.progressImage));
            ImageButton cancel = (ImageButton) root.findViewById(R.id.delete_button);
            TextView progressText = (TextView) root.findViewById(R.id.progressText);

            if (mainActivity.theme1 == 1) {

                root.setCardBackgroundColor(R.color.cardView_foreground);
                root.setCardElevation(0f);
                cancel.setImageResource(R.drawable.ic_action_cancel);
                progressText.setTextColor(Color.WHITE);
                progressImage.setImageResource(R.drawable.ic_doc_compressed);
            } else {

                // cancel has default src set for light theme
                progressText.setTextColor(Color.BLACK);
                progressImage.setImageResource(R.drawable.ic_doc_compressed_black);
            }

            cancel.setOnClickListener(new View.OnClickListener() {

                public void onClick(View p1) {
                    Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.stopping),
                            Toast.LENGTH_LONG).show();
                    Intent i = new Intent("excancel");
                    i.putExtra("id", id);
                    getActivity().sendBroadcast(i);
                    rootView.removeView(rootView.findViewWithTag("extract" + id));

                    ExtractIds.remove(ExtractIds.indexOf(id));
                    CancelledExtractIds.add(id);
                    // TODO: Implement this method
                }
            });

            String name = dataPackage.getName();
            int p1 = dataPackage.getP1();

            ((TextView) root.findViewById(R.id.progressText))
                    .setText(utils.getString(getActivity(), R.string.extracting) + "\n" + name);
            ProgressBar p = (ProgressBar) root.findViewById(R.id.progressBar1);
            p.setProgress(p1);
            ExtractIds.add(id);
            rootView.addView(root);
        }
    }
}

From source file:com.htc.dotdesign.DrawingView.java

@Override
public void resetImgDotMatrixValue() {
    if (mImgDotMatrix != null) {
        for (int row = 0; row < mRowSize; ++row) {
            for (int col = 0; col < mColSize; ++col) {
                if (isShowDotMask) {
                    mImgDotMatrix[row][col] = Color.BLACK;
                } else {
                    mImgDotMatrix[row][col] = sBackgroundColor;
                }/*from  w ww  .  j a  v  a 2  s  .  c om*/
            }
        }
    }
}

From source file:co.ceryle.radiorealbutton.library.RadioRealButtonGroup.java

private void getAttributes(AttributeSet attrs) {
    TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.RadioRealButtonGroup);

    bottomLineColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_bottomLineColor, Color.GRAY);
    bottomLineSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_bottomLineSize, 0);
    bottomLineBringToFront = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_bottomLineBringToFront, false);
    bottomLineRadius = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_bottomLineRadius, 0);

    selectorColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_selectorColor, Color.GRAY);
    selectorBringToFront = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorBringToFront, false);
    selectorAboveOfBottomLine = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorAboveOfBottomLine,
            false);/*from  w  w w. j  av a 2  s .  c o m*/
    selectorSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorSize, 12);
    selectorRadius = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorRadius, 0);

    animateSelector = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateSelector, 0);
    animateSelectorDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateSelector_duration, 500);
    animateSelectorDelay = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateSelector_delay, 0);

    dividerSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_dividerSize, 0);
    boolean hasDividerSize = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_dividerSize);
    dividerRadius = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_dividerRadius, 0);
    dividerPadding = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_dividerPadding, 30);
    dividerColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_dividerColor, Color.TRANSPARENT);
    dividerBackgroundColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_dividerBackgroundColor,
            Color.WHITE);
    hasDividerBackgroundColor = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_dividerBackgroundColor);

    selectorDividerSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorDividerSize,
            dividerSize);
    if (!hasDividerSize) {
        dividerSize = selectorDividerSize;
    }
    selectorDividerRadius = ta
            .getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorDividerRadius, 0);
    selectorDividerPadding = ta
            .getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_selectorDividerPadding, 0);
    selectorDividerColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_selectorDividerColor,
            Color.TRANSPARENT);

    radius = ta.getDimension(R.styleable.RadioRealButtonGroup_rrbg_radius, 0);

    animateImages = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_enter, 0);
    hasAnimateImages = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_enter);
    animateImagesExit = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_exit, 0);
    animateImagesDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_enterDuration,
            500);
    animateImagesExitDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_exitDuration,
            100);
    animateImagesScale = ta.getFloat(R.styleable.RadioRealButtonGroup_rrbg_animateDrawables_scale, 1.2f);

    animateTexts = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_enter, 0);
    hasAnimateTexts = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_enter);
    animateTextsExit = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_exit, 0);
    animateTextsDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_enterDuration, 500);
    animateTextsExitDuration = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_exitDuration, 100);
    animateTextsScale = ta.getFloat(R.styleable.RadioRealButtonGroup_rrbg_animateTexts_scale, 1.2f);

    lastPosition = initialPosition = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_checkedPosition, -1);
    checkedButtonId = ta.getResourceId(R.styleable.RadioRealButtonGroup_rrbg_checkedButton, NO_ID);

    buttonPadding = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPadding, 0);
    buttonPaddingLeft = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingLeft, 0);
    buttonPaddingRight = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingRight, 0);
    buttonPaddingTop = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingTop, 0);
    buttonPaddingBottom = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingBottom,
            0);

    hasPadding = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPadding);
    hasPaddingLeft = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingLeft);
    hasPaddingRight = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingRight);
    hasPaddingTop = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingTop);
    hasPaddingBottom = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_buttonsPaddingBottom);

    groupBackgroundColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_backgroundColor, Color.WHITE);

    selectorTop = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorTop, false);
    selectorBottom = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorBottom, true);

    borderSize = ta.getDimensionPixelSize(R.styleable.RadioRealButtonGroup_rrbg_borderSize,
            ConversionHelper.dpToPx(getContext(), 1));
    borderColor = ta.getColor(R.styleable.RadioRealButtonGroup_rrbg_borderColor, Color.BLACK);

    boolean hasBorderSize = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_borderSize);
    boolean hasBorderColor = ta.hasValue(R.styleable.RadioRealButtonGroup_rrbg_borderColor);
    hasBorder = hasBorderColor || hasBorderSize;

    clickable = ta.getBoolean(R.styleable.RadioRealButtonGroup_android_clickable, true);
    hasClickable = ta.hasValue(R.styleable.RadioRealButtonGroup_android_clickable);
    enabled = ta.getBoolean(R.styleable.RadioRealButtonGroup_android_enabled, true);
    hasEnabled = ta.hasValue(R.styleable.RadioRealButtonGroup_android_enabled);

    animationType = ta.getInt(R.styleable.RadioRealButtonGroup_rrbg_selectorAnimationType, 0);
    enableDeselection = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_enableDeselection, false);

    hasAnimation = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_animate, true);

    selectorFullSize = ta.getBoolean(R.styleable.RadioRealButtonGroup_rrbg_selectorFullSize, false);

    ta.recycle();
}

From source file:it.mb.whatshare.Dialogs.java

/**
 * Sad workaround.//from w w  w .  j av a  2s. c o m
 * 
 * See http://stackoverflow.com/a/7350315/1159164
 * 
 * @param input
 *            the EditText to set the error to
 * @param errorID
 *            the ID of the error in <tt>strings.xml</tt>
 * @param activity
 *            the enclosing activity
 */
private static void setError(EditText input, int errorID, Activity activity) {
    String errorMsg = activity.getResources().getString(errorID);
    if (Build.VERSION.SDK_INT < 11) {
        ForegroundColorSpan fgcspan = new ForegroundColorSpan(Color.BLACK);
        SpannableStringBuilder ssbuilder = new SpannableStringBuilder(errorMsg);
        ssbuilder.setSpan(fgcspan, 0, errorMsg.length(), 0);
        input.setError(ssbuilder);
    } else {
        input.setError(errorMsg);
    }
}

From source file:bikebadger.RideFragment.java

public void SaveGPXFileOnNewThreadWithDialog(final String path) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    final File gpxFile = new File(path);
    pd.setMessage("Saving \"" + gpxFile.getName() + "\"");
    pd.setIndeterminate(true);// w  w  w  . ja  va2 s .  co  m
    pd.setCancelable(false);
    pd.show();
    Thread mThread = new Thread() {
        @Override
        public void run() {
            mRideManager.ExportWaypointsTrack();
            pd.dismiss();
            if (mRideManager.mWaypoints != null) {
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        //Toast.makeText(getActivity(), "Hello", Toast.LENGTH_SHORT).show();
                        MyToast.Show(getActivity(), "\"" + gpxFile.getName() + "\" saved", Color.BLACK);
                    }
                });
            }
        }
    };
    mThread.start();
}

From source file:com.makotojava.android.debate.PolicySpeechFragment.java

private void createSpeechCountDownTimer(long durationInMillis) {
    _speechTimer = new SpeechCountDownTimerWithAlarm(durationInMillis, getCountdownInterval(),
            new SpeechCountDownTimerCallback() {
                //private static final long serialVersionUID = 1L;
                @Override//from   w ww .java2  s.c  om
                public void update(long millisUntilFinished) {
                    updateTimerTextView(_speechTimerTextView, millisUntilFinished);
                    if (getSystemOptions().animateWhenTimerBelowThreshold()) {
                        if (millisUntilFinished < NUMBER_OF_MILLIS_IN_ONE_MINUTE) {
                            if (((millisUntilFinished / 1000) % 60 % 2) == 0)
                                _speechTimerTextView.setTextColor(Color.RED);
                            else
                                _speechTimerTextView.setTextColor(Color.BLACK);
                        }
                    }
                }

                @Override
                public void done() {
                    Log.i(TAG, "Speech Timer is done!");
                    // Beep or flash or something??
                    _speechTimer.exhaust();
                    _speechTimerTextView.setTextColor(Color.RED);
                    if (getSystemOptions().notifyAtTimerExpiration()) {
                        _speechTimer.playNotification(getActivity());
                    }
                    manageState();
                }
            });
}

From source file:com.cypress.cysmart.BLEServiceFragments.HealthTemperatureService.java

/**
 * Setting up the aChart Third party library
 * @param parent/*from  w  w w  .j  a v  a2s  . c o m*/
 */
private void setupChart(View parent) {
    /**
     * Setting graph titles
     */
    String graphTitle = getResources().getString(R.string.health_temperature_graph);
    String graphXAxis = getResources().getString(R.string.health_temperature_time);
    String graphYAxis = getResources().getString(R.string.health_temperature_temperature);

    // Creating an  XYSeries for temperature
    mTempEratureDataSeries = new XYSeries(graphTitle);

    // Creating a dataset to hold each series
    XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset();

    // Adding temperature Series to the dataset
    mDataset.addSeries(mTempEratureDataSeries);

    // Creating XYSeriesRenderer to customize
    XYSeriesRenderer mRenderer = new XYSeriesRenderer();
    mRenderer.setColor(getResources().getColor(R.color.main_bg_color));
    mRenderer.setPointStyle(PointStyle.CIRCLE);
    mRenderer.setFillPoints(true);
    mRenderer.setLineWidth(5);

    int deviceDPi = getResources().getDisplayMetrics().densityDpi;
    switch (getResources().getDisplayMetrics().densityDpi) {
    case DisplayMetrics.DENSITY_XHIGH:
        mMultiRenderer.setMargins(new int[] { 40, 90, 25, 10 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI);
        break;
    case DisplayMetrics.DENSITY_HIGH:
        mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI);
        break;
    case DisplayMetrics.DENSITY_XXHIGH:
        mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI);
        break;

    default:
        if (deviceDPi > DisplayMetrics.DENSITY_XXHIGH && deviceDPi < DisplayMetrics.DENSITY_XXXHIGH) {
            mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 });
            mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI);
        } else {
            mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 });
            mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI);
        }
        break;
    }
    mMultiRenderer.setXTitle(graphXAxis);
    mMultiRenderer.setLabelsColor(Color.BLACK);
    mMultiRenderer.setYTitle(graphYAxis);
    mMultiRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));
    mMultiRenderer.setPanEnabled(true, true);
    mMultiRenderer.setYLabelsColor(0, Color.BLACK);
    mMultiRenderer.setXLabelsColor(Color.BLACK);
    mMultiRenderer.setApplyBackgroundColor(true);
    mMultiRenderer.setBackgroundColor(Color.WHITE);
    mMultiRenderer.setGridColor(Color.BLACK);
    mMultiRenderer.setShowGrid(true);
    mMultiRenderer.setShowLegend(false);

    // Adding mRenderer to multipleRenderer
    mMultiRenderer.addSeriesRenderer(mRenderer);

    // Getting a reference to LinearLayout of the MainActivity Layout
    mGraphLayoutParent = (LinearLayout) parent.findViewById(R.id.chart_container);

    mChart = ChartFactory.getLineChartView(getActivity(), mDataset, mMultiRenderer);

    // Adding the Line Chart to the LinearLayout
    mGraphLayoutParent.addView(mChart);

}

From source file:com.cw.litenote.tabs.TabsHost.java

/**
 * edit page title/*  w  w w.jav a  2 s  .  c o m*/
 *
 */
static void editPageTitle(final int tabPos, final AppCompatActivity act) {
    final DB_folder mDbFolder = mTabsPagerAdapter.dbFolder;

    // get tab name
    String title = mDbFolder.getPageTitle(tabPos, true);

    final EditText editText1 = new EditText(act.getBaseContext());
    editText1.setText(title);
    editText1.setSelection(title.length()); // set edit text start position
    editText1.setTextColor(Color.BLACK);

    //update tab info
    AlertDialog.Builder builder = new AlertDialog.Builder(act);
    builder.setTitle(R.string.edit_page_tab_title).setMessage(R.string.edit_page_tab_message).setView(editText1)
            .setNegativeButton(R.string.btn_Cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    /*cancel*/}
            }).setNeutralButton(R.string.edit_page_button_delete, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // delete
                    Util util = new Util(act);
                    util.vibrate();

                    AlertDialog.Builder builder1 = new AlertDialog.Builder(act);
                    builder1.setTitle(R.string.confirm_dialog_title)
                            .setMessage(R.string.confirm_dialog_message_page)
                            .setNegativeButton(R.string.confirm_dialog_button_no,
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialog1, int which1) {
                                            /*nothing to do*/}
                                    })
                            .setPositiveButton(R.string.confirm_dialog_button_yes,
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialog1, int which1) {
                                            deletePage(tabPos, act);
                                            FolderUi.selectFolder(act, FolderUi.getFocus_folderPos());
                                        }
                                    })
                            .show();
                }
            }).setPositiveButton(R.string.edit_page_button_update, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // save
                    final int pageId = mDbFolder.getPageId(tabPos, true);
                    final int pageTableId = mDbFolder.getPageTableId(tabPos, true);

                    int tabStyle = mDbFolder.getPageStyle(tabPos, true);
                    mDbFolder.updatePage(pageId, editText1.getText().toString(), pageTableId, tabStyle, true);

                    FolderUi.startTabsHostRun();
                }
            }).setIcon(android.R.drawable.ic_menu_edit);

    AlertDialog d1 = builder.create();
    d1.show();
    // android.R.id.button1 for positive: save
    ((Button) d1.findViewById(android.R.id.button1))
            .setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_menu_save, 0, 0, 0);

    // android.R.id.button2 for negative: color
    ((Button) d1.findViewById(android.R.id.button2))
            .setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_menu_close_clear_cancel, 0, 0, 0);

    // android.R.id.button3 for neutral: delete
    ((Button) d1.findViewById(android.R.id.button3))
            .setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_delete, 0, 0, 0);

}

From source file:com.antew.redditinpictures.library.ui.ImageViewerFragment.java

public void initializeWebView() {
    assert mWebView != null : "WebView should not be null!";

    WebSettings settings = mWebView.getSettings();
    settings.setSupportZoom(true);//from   ww w  . j  a v a  2s .  c  om
    settings.setBuiltInZoomControls(true);
    settings.setLoadWithOverviewMode(true);
    settings.setUseWideViewPort(true);
    settings.setDisplayZoomControls(false);
    // Before loading the actual content, let's let the WebView initialize everything.
    mWebView.loadData("<html></html>", "text/html", "utf-8");

    mWebView.setBackgroundColor(Color.BLACK);
    mWebView.setWebViewClient(new WebViewClient() {
        /**
         * Notify the host application that a page has finished loading. This method
         * is called only for main frame. When onPageFinished() is called, the
         * rendering picture may not be updated yet. To get the notification for the
         * new Picture, use {@link android.webkit.WebView.PictureListener#onNewPicture}.
         *
         * @param view
         *     The WebView that is initiating the callback.
         * @param url
         *     The url of the page.
         */
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            // We first initialize the webview with mostly blank HTML content, so don't want to show it until we get to the image.
            if (mWebView != null && mWebViewInitialized) {
                mWebView.setVisibility(View.VISIBLE);
            } else if (!mWebViewInitialized) {
                mWebViewInitialized = true;
            }
        }
    });
    mWebView.setOnTouchListener(getWebViewOnTouchListener());
}

From source file:com.cloverstudio.spika.CameraCropActivity.java

/**
 * Get the image from container - it is already cropped and zoomed If the
 * image is smaller than container it will be black color set aside
 * *//*from  www .ja  v  a  2  s. co m*/
private Bitmap getBitmapFromView(View view) {
    Bitmap returnedBitmap = Bitmap.createBitmap(crop_container_size, crop_container_size,
            Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(returnedBitmap);
    Drawable bgDrawable = view.getBackground();
    if (bgDrawable != null)
        bgDrawable.draw(canvas);
    else
        canvas.drawColor(Color.BLACK);
    view.draw(canvas);
    return returnedBitmap;
}