@Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   if (requestCode == FILECHOOSER_RESULTCODE) { // found this from StackOverflow
     if (null == mUploadMessage) return;
     Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
     mUploadMessage.onReceiveValue(result);
     mUploadMessage = null;
   } else {
     // -----------I wrote this code below this line----------------------------------
     jpegData = intent.getExtras().getByteArray("image");
     Bitmap img = BitmapFactory.decodeByteArray(jpegData, 0, jpegData.length);
     Drawable d = new BitmapDrawable(img);
     profilePicture.setBackground(d);
   }
 }
示例#2
0
  /**
   * Sets the popup colors, when QuickScroll.TYPE_POPUP is selected as type.
   *
   * <p>
   *
   * @param backgroundcolor the background color of the TextView
   * @param bordercolor the background color of the border surrounding the TextView
   * @param textcolor the color of the text
   */
  @SuppressWarnings("deprecation")
  @SuppressLint("NewApi")
  public void setPopupColor(
      final int backgroundcolor,
      final int bordercolor,
      final int borderwidthDPI,
      final int textcolor,
      float cornerradiusDPI) {

    final GradientDrawable popupbackground = new GradientDrawable();
    popupbackground.setCornerRadius(cornerradiusDPI * getResources().getDisplayMetrics().density);
    popupbackground.setStroke(
        (int) (borderwidthDPI * getResources().getDisplayMetrics().density), bordercolor);
    popupbackground.setColor(backgroundcolor);

    if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
      mScrollIndicatorText.setBackgroundDrawable(popupbackground);
    else mScrollIndicatorText.setBackground(popupbackground);

    mScrollIndicatorText.setTextColor(textcolor);
  }