Question: I'm new to Core Data and having a little trouble understanding the best way to fetch data efficiently, particularly with entities that are related.

Imagine that I have two entities: Patients and Appointments. Patients have many Appointments. 

I want to fetch all the patients that haven't had an appointment this [Patient.appointment\_frequency], where appointment\_frequency is weekly, monthly, etc. 

How would I do that, particularly in a way that's fast with hundreds or thousands of Patient objects and hundreds of appointments per patient?

Answer: 
This is because, you are starting other **activity immediately after start the AsyncTask**, It cause bundle empty, So if possible put your staring other activity code in `AsyncTask's postExecute()`.. Then you can get values in other activity.. 

For this pass your activity reference in AsyncTask and using that reference call `startActivity()`..

```
protected void onPostExecute(Void... aa) {
       super.onPostExecute(null);
        //  showDialog("Downloaded " + result + " bytes");
       mContext.startActivity(intent);
       mContext.finish();
     }

```
You passing the value in a bundle

```
 b.putStringArray("cou", sCountryNames);
 b.putStringArray("cid", sCountryCid);
 intent.putExtras(b);

```

So you should get the bundle value like this.

```
 Bundle b = getIntent().getExtras();
 String  mJsonvalue[] = b.getStringArrayList("cou");

```

I think this will solve your problem.