title: I want to add a share button in my app but I do not understand how to implement it, I am showing images from firebase storage in my app
body: <p>I am making a wallpaper app and in this app, I add three buttons like SAVE, SHARE &amp; SET WALLPAPER. Save and Set Wallpaper button works fine but the problem is started in the share button, I want to implement share a button from this button user share my app images anywhere like WhatsApp, etc.</p>
  
  <p>I am put my main code in this question</p>
  
  <p>MY MAIN CODE</p>
  
  <pre><code>public class GamesSecond extends AppCompatActivity {
  
      TextView mTitleTv;
      ImageView mImageIv;
      Button mSaveBtn, mWallBtn, mShareBtn;
  
      Bitmap bitmap;
  
      private static final int WRITE_EXTERNAL_STORAGE_CODE = 1;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_games_second);
  
          ActionBar actionBar = getSupportActionBar();
          actionBar.setTitle("ActionGames");
          actionBar.setDisplayHomeAsUpEnabled(true);
          actionBar.setDisplayShowHomeEnabled(true);
  
          mTitleTv = findViewById(R.id.titleTv);
          mImageIv = findViewById(R.id.imageView);
  
          mSaveBtn = findViewById(R.id.saveBtn);
          mWallBtn = findViewById(R.id.wallBtn);
          mShareBtn = findViewById(R.id.shareBtn);
  
          String images = getIntent().getStringExtra("image");
          String title = getIntent().getStringExtra("title");
  
          mTitleTv.setText(title);
          Picasso.get().load(images).into(mImageIv);
  
          mSaveBtn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M){
                      if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
                              PackageManager.PERMISSION_DENIED){
                          String [] permission = {Manifest.permission.WRITE_EXTERNAL_STORAGE};
                          requestPermissions(permission, WRITE_EXTERNAL_STORAGE_CODE);
                      }
                      else {
                          saveImage();
                      }
                  }
                  else {
                      saveImage();
                  }
              }
          });
  
          mWallBtn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  setWallpaper();
              }
          });
  
          mShareBtn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  shareWall();
              }
          });
      }
  
      private void shareWall() {
  
          &lt;!-- HOW TO WRITE CODE HERE --&gt;
      }
  
      private void setWallpaper() {
  
          bitmap = ((BitmapDrawable)mImageIv.getDrawable()).getBitmap();
  
          WallpaperManager MyWallManager = WallpaperManager.getInstance(getApplicationContext());
          try {
              MyWallManager.setBitmap(bitmap);
              Toast.makeText(this, "Wallpaper set...", Toast.LENGTH_SHORT).show();
          }
          catch (Exception e){
              Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
          }
      }
  
      private void saveImage() {
          bitmap = ((BitmapDrawable)mImageIv.getDrawable()).getBitmap();
  
          String timeStamp = new SimpleDateFormat("yyMMdd_HHmmss",
                  Locale.getDefault()).format(System.currentTimeMillis());
          File path = Environment.getExternalStorageDirectory();
          File dir = new File(path+"/Wallpaper Stack/");
          dir.mkdirs();
  
          String imageName = timeStamp + ".PNG";
          File file = new File(dir, imageName);
          OutputStream out;
          try{
              out = new FileOutputStream(file);
              bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
              out.flush();
              out.close();
              Toast.makeText(this, imageName+" save to"+ dir, Toast.LENGTH_SHORT).show();
          }
          catch (Exception e){
              Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
          }
      }
  
      @Override
      public boolean onSupportNavigateUp() {
          onBackPressed();
          return true;
      }
  
      @Override
      public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
          switch (requestCode){
              case WRITE_EXTERNAL_STORAGE_CODE:{
                  if(grantResults.length &gt; 0 &amp;&amp; grantResults[0] ==
                          PackageManager.PERMISSION_GRANTED){
                      saveImage();
                  }
                  else {
                      Toast.makeText(this, "Enable permission to save image", Toast.LENGTH_SHORT).show();
                  }
              }
          }
      }
  }
  </code></pre>