I have an application that I am developing where I am sending an
intent from the Application class.  The intent has extras, and I am
using sendBroadcast.  Everytime I try and send the intent I get a
nullreferencepointer exception.  I have tried sending it from my
onDecodedData method as well as from another method that is called by
onDecodedData.  Now I am trying to call it from a class that extends
broadcast receiver.  Nothing is working.  Here is my code for sending
the intent:


public void onDecodedData(DeviceInfo deviceInfo,
                                ISktScanDecodedData decodedData) {
                        // Log.d(TAG, "Received Scan");
                        // if(_scanwindow!=null)
                        //
_scanwindow.DoScannedData(decodedData.getData(),decodedData.getSymbologyName());
                        char[] data = decodedData.getData();
                        String processedData = processData(data);
                        Log.d(TAG, "Received Scan = " + processedData);
                        // Intent intentsent = new Intent(
                        // PickupItemsActivity.NOTIFY_DATA_ARRIVAL);
                        // Intent intentsent = new Intent();
                        // 
intentsent.setAction(PickupItemsActivity.NOTIFY_DATA_ARRIVAL);
                        // char[] data = decodedData.getData();
                        // 
intentsent.putExtra("com.SocketMobile.ScannerSettings.Data",
                        // processedData);
                        // String symbologyName = 
decodedData.getSymbologyName();
                        //
intentsent.putExtra("com.SocketMobile.ScannerSettings.Symbology",
                        // symbologyName);
                        try {
                                // sendScanData(processedData);
                                new SendIntents().sendIntent(processedData);
                                Log.d(TAG, "Scan Intent Sent");
                        } catch (Exception e) {
                                Log.d(TAG, "Error = " + e.getMessage());
                        }
                }

private class SendIntents extends BroadcastReceiver {
                ProgressDialog dialog;

                @Override
                public void onReceive(Context arg0, Intent arg1) {
                        // TODO Auto-generated method stub

                }

                public void sendIntent(String msg) {
                        /*Intent intentsent = new Intent(
                                        
PickupItemsActivity.NOTIFY_DATA_ARRIVAL);
                        intentsent
                                        
.putExtra("com.guardianml.android.handset.Scan.Data", msg);
                        sendBroadcast(intentsent);*/
                        sendBroadcast(new Intent(
                                        
PickupItemsActivity.NOTIFY_DATA_ARRIVAL));
                        Log.d(TAG, "Sending Intent Sent");

                }
        }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to