I am getting an error with not a concrete class when I add the Activity in the AndroidManifest. Please help me figure out the problem by removing abstract class for the activity but it doesn't resolve.
public abstract class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_fragment);
setUpMap();
}
@Override
protected void onResume() {
super.onResume();
setUpMap();
}
@Override
public void onMapReady(GoogleMap map) {
if (mMap != null) {
return;
}
mMap = map;
startDemo();
}
private void setUpMap() {
((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMapAsync(this);
}
/**
* Run the demo-specific code.
*/
protected abstract void startDemo();
protected GoogleMap getMap() {
return mMap;
}
}
A concrete class is complete. Because all of its methods are implemented, we call it a concrete class, and we can instantiate it: Car car = new Car(); Some examples of concrete classes from the JDK are HashMap, HashSet, ArrayList, and LinkedList.
Abstract class can have both an abstract as well as concrete methods. A concrete class can only have concrete methods. Even a single abstract method makes the class abstract. Abstract class can not be instantiated using new keyword.
A concrete class is a class that has an implementation for all of its methods. They cannot have any unimplemented methods. It can also extend an abstract class or implement an interface as long as it implements all their methods. It is a complete class and can be instantiated.
You don't need declare abstract
super classes in your manifest
In your manifest you only need to include Activity classes that you are going to instantiate for example with an Intent.
If your abstract class only exists to subclass other Activities ( subclasses ) then you need to add those Activities in the Manifest.
If your class doesn't have subclasses then remove abstract
from your class declaration :
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
And remove also your abstract method :
protected abstract void startDemo();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With