I have created an activity that calls a service. This service receive
an XML feed and parse the info. Each time I get the info for a new
station i want to send the details (Name,Id,Location all as string)
back to my main activity so it can load it inside a list view. When I
run my code inside the main activity it works. When I move it to a
service I cant send the data back. This is what I have tried.

After getting the current station info from I do this:
submitStation(namer, loc, ids, dis, types);

then:

private void submitStation(String names, String loca, String idss,
String diss, String typess){

        Intent intent = new Intent(NEW_STATION_LISTING);
        intent.putExtra("StationName",names);
        intent.putExtra("Sid", loca);
        intent.putExtra("StationLoc", idss);
        intent.putExtra("Distance", diss);
        intent.putExtra("Types", typess);

        sendBroadcast(intent);
}

Now in my main activity I have this:

 public class StationReceiver extends BroadcastReceiver{
        @Override
        public void onReceive(Context context, Intent intent){

                String sname = intent.getExtras().getString("StationName");
                String sloc = intent.getExtras().getString("StationLoc");
                String ids = intent.getExtras().getString("Sid");
                String dist = intent.getExtras().getString("Distance");
                String stype = intent.getExtras().getString("Types");
                Stations station = new Stations(sname,sloc,ids,dist,stype);
                stations.add(station);
                aa.notifyDataSetChanged();
        }
    }

Any help is greatly appreciated!

-- 
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