Rotated image in ImageView
<p>I want to show an arrow that indicates the direction towards a goal, using the orientation sensor and current GPS position. Everything works well, except that I want to rotate the arrow image in my ImageView.</p>

<p>The current code, which shows the arrow pointing upwards, is this:</p>

<pre><code>ImageViewArrow.setImageResource(R.drawable.arrow);
</code></pre>

<p>What is the best solution for showing the arrow, rotated by N degrees?</p>

<p>I tried this, but it gave messed up graphics:</p>

<pre><code>Matrix matrix = new Matrix(); 
matrix.postRotate(Rotation);
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(), 
  R.drawable.arrow); 
Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,
  bitmapOrg.getWidth(),bitmapOrg.getHeight(), matrix, true); 
BitmapDrawable bmd = new BitmapDrawable(resizedBitmap);
InfoArrow.setScaleType(ScaleType.CENTER);
InfoArrow.setImageDrawable(bmd);
</code></pre>
