Question: I have `Dictionary(Of List(Of Object), Integer)` and need to get my dictionary grouped by keys.

For example: 

```
Dictionary (0) = Key: {List(12, "SomeString", 3)} Value: 54

Dictionary (1) = Key: {List(8, "SomeAnotherString", 3)} Value: 6

Dictionary (2) = Key: {List(12, "SomeString", 3)} Value: 15

```

How can I get this `Dictionary` looks like:

```
Dictionary (0) = Key: {List(12, "SomeString", 3)} Value: 54, 15

Dictionary (1) = Key: {List(8, "SomeAnotherString", 3)} Value: 6

```

Answer: 
AsyncTask.execute() is a non-blocking call. You can't set the result to the Bundle and start an Intent immediatly after execute(). That's why you are getting a NPE in your second Activity because `sending` isn't initialized, so it's null.

Move the code to start a new Activity with the desired data in your callback:

```
  public void processFinish(String output){

        bnd.putString("veri", output);
        intent.putExtras(bnd);
        startActivity(intent);

   }

```

And make sure you call `delegate.processFinished(String)` if your data processing is finished. So move it out of the for loop. BTW `t` will only get the last "name"-String in the JSONArray. If you wanna get them all make `t` a String array and fill it.
Shortly before someone posted a solution and it works without any errors but it was deleted. This solution is by this way: 

```
   public void onClick(View arg0) {
        asyncTask.execute(true);
        }
    });
    }

```

Then OnPostExecute changed like this:

```
  protected void onPostExecute(String result) {
        Intent passValue=new Intent(MainActivity.this, second.class);
        try {
            JSONArray jArray = new JSONArray(result);
            JSONObject json_data;
            for (int i = 0; i < jArray.length(); i++) {
                json_data = jArray.getJSONObject(i);

                t = json_data.getString("name");
                          delegate.processFinish(t);

             }
            passValue.putExtra("veri", t);
             startActivity(passValue);   

        } catch (JSONException e1) {
            e1.printStackTrace();
        } catch (ParseException e1) {
            e1.printStackTrace();
        }
        super.onPostExecute(result);
    }

```

Lastly in my second activity receive the string by this way:

```
    String receivedVal= getIntent().getExtras().getString("veri");
    Log.v(TAG, receivedVal);

```

Thank you someone who posted this solution shortly before :)