不是AndroidManifest的具体类 [英] Is not a concrete class AndroidManifest

查看:64
本文介绍了不是AndroidManifest的具体类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在AndroidManifest中添加Activity时,出现了一个非具体类的错误.请通过删除活动的抽象类来帮助我解决问题,但是它不能解决.

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

}

推荐答案

您不需要在清单中声明abstract超级类

You don't need declare abstract super classes in your manifest

在清单中,您仅需要包含要实例化的Activity类,例如,一个Intent.

In your manifest you only need to include Activity classes that you are going to instantiate for example with an Intent.

如果您的抽象类仅存在于其他Activity(子类)的子类中,那么您需要将这些Activity添加到清单中.

If your abstract class only exists to subclass other Activities ( subclasses ) then you need to add those Activities in the Manifest.

如果您的类没有子类,则从类声明中删除abstract:

If your class doesn't have subclasses then remove abstract from your class declaration :

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

并删除您的抽象方法:

protected abstract void startDemo(); 

这篇关于不是AndroidManifest的具体类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆