title: parse incoming message from pubnub
body: <p>I'm having a hard time with this one...</p>
  
  <p>I have a data coming into a service from a pubnub connection</p>
  
  <pre><code>public void Startpubnub() {
  Toast.makeText(this, "PubnubService created...", Toast.LENGTH_LONG).show();
  Log.i("PUBNUB", "PubnubService created...");
  try {
      pubnub.subscribe(new String[] {channel}, new Callback() {
          public void connectCallback(String channel) {
  
              notifyUser("CONNECT on channel:" + channel);
          }
          public void disconnectCallback(String channel) {
              notifyUser("DISCONNECT on channel:" + channel);
          }
          *public void reconnectCallback(String channel) {
              notifyUser("RECONNECT on channel:" + channel);
          }
          @**Override
          public void successCallback(String channel, Object message) {
              Log.i("tag","broadcast is sent!");
              //notifyUser(channel + " " + message.toString());
              Gson gson = new Gson();
              String jsonMessage = gson.toJson(message);
              System.out.printf("tag",jsonMessage);
              JSONObject json = null;
              try {
                  json = new JSONObject(jsonMessage);
              } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              System.out.printf("tag",json);
              String data = null;
              try {
                  data = json.getString("data");
              } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              Log.i("tag",data);**
  
          }*
  
  
  
          02-06 03:32:58.752: W/System.err(2690): org.json.JSONException: No value for data
  </code></pre>
  
  <p>02-06 03:32:58.752: W/System.err(2690):     at org.json.JSONObject.get(JSONObject.java:354)
  02-06 03:32:58.762: W/System.err(2690):     at org.json.JSONObject.getString(JSONObject.java:510)
  02-06 03:32:58.762: W/System.err(2690):     at tv.loqoo.FourthScreen.FourthScreenPushService$2.successCallback(FourthScreenPushService.java:120)
  02-06 03:32:58.762: W/System.err(2690):     at com.pubnub.api.PubnubCore$7.handleResponse(PubnubCore.java:1483)
  02-06 03:32:58.762: W/System.err(2690):     at com.pubnub.api.SubscribeWorker.process(SubscribeWorker.java:105)
  02-06 03:32:58.762: W/System.err(2690):     at com.pubnub.api.Worker.run(RequestManager.java:81)
  02-06 03:32:58.762: W/System.err(2690):     at java.lang.Thread.run(Thread.java:856)
  02-06 03:32:58.762: W/dalvikvm(2690): threadid=24: thread exiting with uncaught exception (group=0x418b6300)
  02-06 03:32:58.762: W/System.err(2690): java.lang.NullPointerException: println needs a message
  02-06 03:32:58.762: W/System.err(2690):     at android.util.Log.println_native(Native Method)
  02-06 03:32:58.762: W/System.err(2690):     at android.util.Log.i(Log.java:159)
  02-06 03:32:58.762: W/System.err(2690):     at tv.loqoo.FourthScreen.FourthScreenPushService$2.successCallback(FourthScreenPushService.java:125)
  02-06 03:32:58.762: W/System.err(2690):     at com.pubnub.api.PubnubCore$7.handleResponse(PubnubCore.java:1483)
  02-06 03:32:58.762: W/System.err(2690):     at com.pubnub.api.SubscribeWorker.process(SubscribeWorker.java:105)
  02-06 03:32:58.762: W/System.err(2690):     at com.pubnub.api.Worker.run(RequestManager.java:81)
  02-06 03:32:58.762: W/System.err(2690):     at java.lang.Thread.run(Thread.java:856)</p>
  
  <p>In the successCallback im trying to parse the incoming message as a jsonobject and send the extras to a broadcast reciever.</p>
  
  <p>I'm having extreme trouble making any sense of how to parse...Object message.</p>
  
  <p>this is the format of the incoming message:</p>
  
  <pre><code>        5 info = pubnub.publish({
          6     'channel' : 'somechannel',
          7     'message' : {
          8         'data' : 'Hello my World',
          9         'data2' : 'yup',
          10         'data3' : 'yupyup'
          11     }
          12 })
  </code></pre>