How to change bitmap height and width programmatically in android? <p>I want to resize the bitmap height &amp; width into same as the user device width &amp; height.So please help me if u know the code.Thank You !</p> <p>This is my code:</p> <pre><code> Bitmap bm = BitmapFactory.decodeResource(getResources(),R.drawable.nature); DisplayMetrics metrics = getApplicationContext().getResources().getDisplayMetrics(); width = metrics.widthPixels; height=metrics.heightPixels; </code></pre> <p>But it was not working</p>