view.invalidate not working
<p>I have a <code>PuzzleView</code> class which extends View and refers it in xml in main class. It is shown in emulator without any error. But the invalidate function in PuzzleView is not working. That is the main class xml that contains view doesn't refresh. But it will be worked when directly using setContentView(PuzzleView) in main class. I know what is wrong when using xml. Please help me.</p>

<p>I also used </p>

<pre><code>ViewGroup vg = (ViewGroup) findViewById(R.layout.game);
vg.invalidate();
</code></pre>

<p>in PuzzleView class. But it throws null pointer exception.</p>
