Android - checking for certain value does not
<p>I am working on Android billing and trying to set the onPurchaseStateChange method correct, but it does not seem to be working.</p>

<pre><code>    @Override
    public void onPurchaseStateChange(PurchaseState purchaseState, String itemId,
            int quantity, long purchaseTime, String developerPayload) 
    {
        if (purchaseState == PurchaseState.PURCHASED) 
        {
            mOwnedItems.add(itemId);

            if ( itemId != null &amp;&amp; itemId.trim().equals("3") )
            {
                  Intent myIntent = new Intent(ExtraHelpActivity.this, PsychologyActivity.class);
                  ExtraHelpActivity.this.startActivity(myIntent);
            }
            if ( itemId != null &amp;&amp; itemId.trim().equals("4") )
            {
                  Intent myIntent = new Intent(ExtraHelpActivity.this, NumberOfBusinessesActivity.class);
                  ExtraHelpActivity.this.startActivity(myIntent);   
            }                
        }
        else 
        if (purchaseState == PurchaseState.CANCELED) 
        {  
            // purchase canceled
        } 
        else 
        if (purchaseState == PurchaseState.REFUNDED) 
        {
            // user ask for a refund
        }
        else
        {   
            if ( itemId != null &amp;&amp; itemId.equals("3") )
            {
                  Intent myIntent = new Intent(ExtraHelpActivity.this, PsychologyActivity.class);
                  ExtraHelpActivity.this.startActivity(myIntent);
            }
            if ( itemId != null &amp;&amp; itemId.equals("4") )
            {
                  Intent myIntent = new Intent(ExtraHelpActivity.this, NumberOfBusinessesActivity.class);
                  ExtraHelpActivity.this.startActivity(myIntent);   
            }                   
        }
</code></pre>

<p>So when the purchaseId is "4" or "3" and the purchaseState == PurchaseState.PURCHASED ....for some reason it does not seem to get into that if statement, and does not perform the intent to go to the next page?</p>

<p>Would anyone know why that happens? It seems very strange. Could it be a Java thing?</p>

<p>Thanks! </p>
