title: How should I add a watermark effect to an image in Android?
body: <p>I am new for android and i want to add watermark effect on captured images and i am trying find the solution for it since 2 days but still not able to add watermark effect on captured images can some one help me what i did mistack in my below code..</p>
  <p>I want add water mark effect on bottom middle of image</p>
  <h2>Code</h2>
  <pre><code>private void onCaptureImageResult(Intent data) {
              Bitmap photo;Bitmap watermark_bitmap=null;
              String selectedFilePath = null;
              if (data.getExtras().get(&quot;data&quot;) != null) {
                  photo = (Bitmap) data.getExtras().get(&quot;data&quot;);
                  watermark_bitmap=Utilities.mark(this,photo,&quot;Hello World&quot;,true);
                  Uri contentUri = Utilities.getImageUri1(
                          this, watermark_bitmap);
                  selectedFilePath = ImageFilePath.getPath(
                          this, contentUri);
                  newMeter_image.setImageBitmap(watermark_bitmap); 
             }
  
  
  
   public static Bitmap mark(Context context,Bitmap src, String watermark, boolean underline) {
          int w = src.getWidth();
          int h = src.getHeight();
          Bitmap result = Bitmap.createBitmap(w, h, src.getConfig());
  
          Canvas canvas = new Canvas(result);
          canvas.drawBitmap(src, 0, 0, null);
  
          Paint paint = new Paint();
          int color = ContextCompat.getColor(context, R.color.black);
          paint.setColor(color);
          paint.setAlpha(1);
          paint.setTextSize(5);
          paint.setAntiAlias(true);
          paint.setUnderlineText(underline);
          canvas.drawText(watermark, 50,50, paint);
          return result;
      }
  </code></pre>