List of usage examples for android.content Intent getSerializableExtra
public Serializable getSerializableExtra(String name)
From source file:Main.java
/** * Read the PDUs out of an SMS_RECEIVED_ACTION or a * DATA_SMS_RECEIVED_ACTION intent./* w w w . j a v a 2 s . co m*/ * * @param intent the intent to read from * @return an array of SmsMessages for the PDUs */ public static SmsMessage[] getMessagesFromIntent(Intent intent) { Object[] messages = (Object[]) intent.getSerializableExtra("pdus"); String format = intent.getStringExtra("format"); int pduCount = messages.length; SmsMessage[] msgs = new SmsMessage[pduCount]; for (int i = 0; i < pduCount; i++) { byte[] pdu = (byte[]) messages[i]; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { msgs[i] = SmsMessage.createFromPdu(pdu, format); } else { msgs[i] = SmsMessage.createFromPdu(pdu); } } return msgs; }
From source file:Main.java
/** * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a * {@link #DATA_SMS_RECEIVED_ACTION} intent. * /*from ww w .ja v a 2 s . co m*/ * @param intent * the intent to read from * @return an array of SmsMessages for the PDUs */ public static final SmsMessage[] getMessagesFromIntent(Intent intent) { Object[] messages = (Object[]) intent.getSerializableExtra("pdus"); if (messages == null) { return null; } if (messages.length == 0) { return null; } byte[][] pduObjs = new byte[messages.length][]; for (int i = 0; i < messages.length; i++) { pduObjs[i] = (byte[]) messages[i]; } byte[][] pdus = new byte[pduObjs.length][]; int pduCount = pdus.length; SmsMessage[] msgs = new SmsMessage[pduCount]; for (int i = 0; i < pduCount; i++) { pdus[i] = pduObjs[i]; msgs[i] = SmsMessage.createFromPdu(pdus[i]); } return msgs; }
From source file:Main.java
public static Serializable getSerializableExtra(Intent intent, String name) { if (!hasIntent(intent) || !hasExtra(intent, name)) return null; return intent.getSerializableExtra(name); }
From source file:info.martinmarinov.dvbservice.DvbService.java
static StatusMessage parseMessage(Intent intent) { return (StatusMessage) intent.getSerializableExtra(STATUS_MESSAGE); }
From source file:ack.me.truconnectandroiddemo.TruconnectService.java
public static TruconnectCommand getCommand(Intent intent) { return (TruconnectCommand) intent.getSerializableExtra(EXTRA_COMMAND); }
From source file:ack.me.truconnectandroiddemo.TruconnectService.java
public static TruconnectErrorCode getErrorCode(Intent intent) { return (TruconnectErrorCode) intent.getSerializableExtra(EXTRA_ERROR); }
From source file:com.github.baoti.pioneer.ui.news.NewsActivity.java
public static News pickedNews(int resultCode, Intent data) { if (resultCode != RESULT_PICKED) { return null; }/* w w w. j a v a2 s. com*/ return (News) data.getSerializableExtra(EXTRA_NEWS); }
From source file:com.zentri.zentri_ble_command_demo.ZentriOSBLEService.java
public static Command getCommand(Intent intent) { return (Command) intent.getSerializableExtra(EXTRA_COMMAND); }
From source file:com.zentri.zentri_ble_command_demo.ZentriOSBLEService.java
public static ErrorCode getErrorCode(Intent intent) { return (ErrorCode) intent.getSerializableExtra(EXTRA_ERROR); }
From source file:com.ez.gallery.ucrop.UCrop.java
/** * Method retrieves error from the result intent. * * @param result crop result Intent/*from ww w . jav a 2 s. c om*/ * @return Throwable that could happen while image processing */ @Nullable public static Throwable getError(@NonNull Intent result) { return (Throwable) result.getSerializableExtra(EXTRA_ERROR); }