I am following this tutorial but when I add the code to eclipse, everywhere the "i" int is called, eclipse gives the error "int cannot be converted to a boolean". Yet that is how it is in the code. How can I fix this without ruining the code or can I bypass that check? I've looked all over the internet on how to recieve sms and they all are the same. I get the same error in the code. Here's the link to the tutorial:
I've searched all over stack overflow as well and every code I've found gives me the same error in eclipse.
EDIT 6/23/13: Here's my code. I've fixed the "i" int issue but now I'm getting errors on lines 33, 35, and 41. "Unreachable code"
SMSReceiver:
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
public class SMSReceiver extends BroadcastReceiver
{
private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
private World world;
public SMSReceiver(World paramWorld)
{
this.world = paramWorld;
}
public void onReceive(Context paramContext, Intent paramIntent)
{
Object[] arrayOfObject;
SmsMessage[] arrayOfSmsMessage;
int i;
if (paramIntent.getAction().equals("android.provider.Telephony.SMS_RECEIVED"))
{
Bundle localBundle = paramIntent.getExtras();
if (localBundle != null)
{
arrayOfObject = (Object[])localBundle.get("pdus");
arrayOfSmsMessage = new SmsMessage[arrayOfObject.length];
i = 0;
if (i < arrayOfObject.length)
break label68;
if (arrayOfSmsMessage.length <= -1)
break label90;
}
}
label68: label90: for (this.world.haveUnreadMessage = true; ; this.world.haveUnreadMessage = false)
{
return;
arrayOfSmsMessage[i] = SmsMessage.createFromPdu((byte[])arrayOfObject[i]);
i++;
break;
}
}
}