use this run() method
public Object run(Object context) {
if (context == null) {
return null;
}
if (!(context instanceof BlackBerryContact)) {
return null;
}
BlackBerryContact c = (BlackBerryContact)context;
if (c != null) {
int numValues = 0;
String contactnames = new String();;
try {
numValues = c.countValues(BlackBerryContact.TEL);
contactnames = new String();
} catch (Exception e) {
}
for (int i = 0; i < numValues; i++) {
if (c.getAttributes(BlackBerryContact.TEL, i) == BlackBerryContact.ATTR_WORK) {
contactnames = c.getString(BlackBerryContact.TEL, i);
} else if (c.getAttributes(BlackBerryContact.TEL, i) == BlackBerryContact.ATTR_HOME) {
contactnames = c.getString(BlackBerryContact.TEL, i);
} else if (c.getAttributes(BlackBerryContact.TEL, i) == BlackBerryContact.ATTR_MOBILE) {
contactnames = c.getString(BlackBerryContact.TEL, i);
} else if (c.getAttributes(BlackBerryContact.TEL, i) == BlackBerryContact.ATTR_OTHER) {
contactnames = c.getString(BlackBerryContact.TEL, i);
}
}
reciever = contactnames;
Application.getApplication().requestForeground();
// on invocation, will call the main method of this app. with
// argument as specified in addMenuItem
} else {
throw new IllegalStateException(
"Context is null, expected a textmessage instance"
+ context.toString());
}
return null;
}
|