title: I'm using the new Places SDK in Android. The AutocompleteSupportFragment and it is requiring me to add the activity to the manifest
body: <p>I'm using the new places SDK.  My build.gradle:</p>
  
  <pre><code>implementation 'com.google.android.libraries.places:places:1.0.0'
  </code></pre>
  
  <p>My code: </p>
  
  <pre><code> FragmentManager supportFragmentManager = getChildFragmentManager();
   FragmentTransaction ft = supportFragmentManager.beginTransaction();
   if(mAutocompleteFragment == null) {
        mAutocompleteFragment = new AutocompleteSupportFragment();
        ft.add(R.id.places_container, mAutocompleteFragment, AutocompleteSupportFragment.class.getSimpleName());
        ft.commit();
      }
  
  List&lt;Place.Field&gt; places = new ArrayList&lt;&gt;();
  places.add(Place.Field.ID);
  places.add(Place.Field.NAME);
  places.add(Place.Field.ADDRESS);
  mAutocompleteFragment.setPlaceFields(places); //throws NPE getView() is null
  </code></pre>
  
  <p>Throws NPE, because it is trying to set view enabled in that last method and the view is null.  I suspect that the lifecycle of the fragment has not been called (onViewCreated). How would I force the lifecycle or wait for the fragment to fully cycle?</p>
  
  <p>However, when I select the autocompletesupportfragment, I get a:</p>
  
  <blockquote>
    <p>android.content.ActivityNotFoundException: Unable to find explicit activity class {com.activehours.debug/com.google.android.libraries.places.widget.AutocompleteActivity}; have you declared this activity in your AndroidManifest.xml?</p>
  </blockquote>
  
  <p>Here is my manifest: </p>
  
  <pre><code>    &lt;activity
      android:name="com.google.android.libraries.places.widget.AutocompleteActivity"
          android:theme="@style/PlacesAutocompleteThemeOverlay"&gt;
      &lt;/activity&gt;
  </code></pre>
  
  <p>The <a href="https://developers.google.com/places/android-sdk/autocomplete#option_1_embed_an_autocompletesupportfragment" rel="nofollow noreferrer">documentation</a> made no mention of including the activity in my manifest.  Help!</p>
  
  <p><strong>EDIT:</strong> I got the around the NPE by extending the class as such:</p>
  
  <pre><code>public class AHAutocompleteSupportFragment extends AutocompleteSupportFragment 
   {
  
    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
      List&lt;Place.Field&gt; places = new ArrayList&lt;&gt;();
      places.add(Place.Field.ID);
      places.add(Place.Field.NAME);
      places.add(Place.Field.ADDRESS);
      this.setPlaceFields(places);
    }
  }
  </code></pre>
  
  <p>However, I am still getting the "Activity not declared in Manifest".  </p>