Unable to instantiate a nested class ( extends broadcastReceiver ) when a sendBroadcast is made
<p>I am developing an application in Android and have an issue where Android framework throws java.lang.InstantiationException upon trying to instantiate a nested class. 
Here is the scenario.</p>

<ol>
<li><p>Class A extending Activity with nested class B which extends BroadcastReceiver: </p>

<pre><code>public class A extends Activity
{
    public void onCreate(){
    ....};
    //Class B
    public class B extends BroadcastReceiver
    {
        public void onReceive(...)
    }
}
</code></pre></li>
<li><p>Class declarations in manifest file :

    
        ....
    


    
        
        
    
     </p></li>
</ol>

<p>Sorry for the bad indentation. Just couldn't find a way of properly indenting the code with so many tags. </p>

<ol>
<li>Broadcast from a service :</li>
</ol>

<pre><code>
    Intent updateIntent = new Intent();
    updateIntent.setAction("desired_action");
    sendBroadcast(accountPropertyUpdateIntent);
</code></pre>

<p>With all the above given things, the code gets compiled, but when run on the device, after the broadcast is called, i get a InstantiationException saying cannot instantiate pacakage.A$B, and dalvik says no  found.</p>

<p>Now this whole scenario works on Android 2.2, but somehow this fails on 2.1.</p>

<p>I don't know exactly what is happening. Am in need of help. Maybe something basic is missing by me.</p>

<p>Can anyone please help me? Thanks in advance.    </p>
