refreshing and reloading an Activity from a Service without exiting the Activity, Android appwidget
<p>Good day, I have an activity which i navigate to from an icon on an appwidget using pending Intents. Everything is being done in a service class. Now, the activity has a refresh button which when pressed, it sends an intent that calls the onStart() method on the service to update itself and perform some web operations. How do i go about reflecting the changes that could have occurred from the service in the activity without temporarily existing the activity. </p>

<p>Service to Activity:</p>

<pre><code>if(intent.getExtras()!= null){
      appWidgetId = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);

      //if i get this action from my detailedinfo class add a boolean to it

      if(intent.getAction() == refresh_action){

     // boolean variable to hold condition
          my_action = true;
      }



Intent forecast = new Intent(this,detailedInfo.class );
    forecast.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
        forecast.putExtra("cityname", city);

 PendingIntent forecastIntent = PendingIntent.getActivity(this, 0, forecast, 0);

        /*onclick to go to detailedInfo class*/
        remoteView.setOnClickPendingIntent(R.id.city_image_id, forecastIntent);


        if(my_action == true){          
            //Log.d(TAG, "my_action is true, performing pending intent");

            try {
                forecastIntent.send(this, 0, forecast);
            } catch (CanceledException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
</code></pre>

<p>And in the Activity class:</p>

<pre><code>Intent service = new Intent(this, cityService.class);
        service.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        service.setAction(refresh_action);
        Uri data = Uri.withAppendedPath(Uri.parse(CityWidgetProvider.URI_SCHEME + "://widget/id/"), String.valueOf(appWidgetId));
        service.setData(data);
               startService(service);
</code></pre>

<p>I tried adding a setAction() method to the intent that calls the service and then use the same pendingIntent(even though i think is a long shot) but they seems to be ignored. Please how do i go about this and what could i have been doing wrong.? As usual any help is highly appreciated. Thank you.</p>
