Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is not a concrete class AndroidManifest

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;
    }

}
like image 211
Savita Avatar asked Apr 13 '16 11:04

Savita


People also ask

What is concrete class example?

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.

Can an abstract class be concrete?

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.

What is concrete class or method?

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.


1 Answers

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(); 
like image 50
Guillaume Barré Avatar answered Sep 22 '22 03:09

Guillaume Barré