Reputation: 73
I have been unable to get Android Studio to recognize two symbols. "container" and "PlaceHolderFragment". This is the piece
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceHolderFragment())
.commit();
}
The dependencies in my XML file read
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
and I have made sure Google Play Services rev 26, Google Repository rev 21, Android Support Repository rev 20, and Android Support Library rev 23.0.1 are all installed as SDK tools. I have also tried invalidating caches and restarting.
Thank you for your help,
Matt
Upvotes: 0
Views: 870
Reputation: 5261
You will have to create PlaceHolderFragment class in your project which will extend Fragment class. Also container in the R.id.container is the id of the container in which fragment is present. So you need to define that accordingly in xml.
Upvotes: 1