Is not a concrete class AndroidManifest

淺唱寂寞╮ 提交于 2019-12-23 07:27:40

问题


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

}

回答1:


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(); 


来源:https://stackoverflow.com/questions/36597304/is-not-a-concrete-class-androidmanifest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!