title: Android: App Widget Configuration Activity does not behave like Activity (Edited from: Android: AppWidget not embedding into home screen)
body: <p>(Edit here - Original post below)</p>
  
  <p>I have narrowed the original problem to this: the home key simply doesn't behave the same for a regular activity and an appwidget configuration activity.
  I made a test with the following minimal activity:</p>
  
  <pre><code>public class TestActivity extends Activity {    
    Logger logger = Logger.getLogger("logger");   
    @Override
      public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState);
    }
    @Override
    protected void onUserLeaveHint() {
      logger.info("userleave");
      super.onUserLeaveHint();
    }
  }
  </code></pre>
  
  <p>Creating a simple app with this simple activity works as intended. Creating the simplest possible widget with no functionality at all, using this activity as an App Widget Configuration Activity, the LogCat doesn't get our logger.info().</p>
  
  <p>Any clues?</p>
  
  <p>Best regards</p>
  
  <p>(Original post here)</p>
  
  <p>I have a working widget consisting of buttons launching activities. One of these is a configuration activity, and it would be fitting to double as an "App Widget Configuration Activity" - i.e. call it when the user embeds the widget into their home screen.</p>
  
  <p>Following the Android dev guide, I added this code to the settings activity:</p>
  
  <pre><code>Intent intent = getIntent();
      Bundle extras = intent.getExtras();
      if (extras != null) {
          int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
          if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
              AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this);
              RemoteViews views = new RemoteViews(this.getPackageName(), R.layout.widgetlayout);
              appWidgetManager.updateAppWidget(appWidgetId, views);
              Intent resultValue = new Intent();
              resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
              setResult(RESULT_OK, resultValue);
              finish();
          }
      }
  </code></pre>
  
  <p>Added in onCreate(), the activity doesn't appear - quite logical, since it calls finish(), and everything else works as intended.</p>
  
  <p>What I want to do, is add it in onPause(), because it's pleasing to quit a configuration activity by using the back or home button, as the absence of a "save &amp; exit" button implies automatic saving. 
  Added in onPause(), <em>the widget doesn't get embedded to the home screen</em>. LogCat doesn't show anything more grievous than info. </p>
  
  <p>EDIT:
  Narrowed to an issue involving onPause() and the hardware home button. The hardware back button, lets the widget gets embed in the Home Screen.</p>
  
  <p>If anyone has a hint, I'd be most pleased, thank you in advance.</p>