由于没有调用super.OnCreate(),即使ListFragment中存在调用,应用程序也会崩溃

时间:2014-11-07 07:49:28

标签: java android android-support-library

我的应用程序因SuperNotCalledException崩溃。 我已在super.OnCreate(savedInstanceState);中呼叫OnCreate()。这是我的代码。

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Get max available VM memory, exceeding this amount will throw an
    // OutOfMemory exception. Stored in kilobytes as LruCache takes an
    // int in its constructor.
    final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);

    // Use 1/8th of the available memory for this memory cache.
    final int cacheSize = maxMemory / 8;

    mMemoryCache = new LruCache<String, Bitmap>(cacheSize) {
        @Override
        protected int sizeOf(String key, Bitmap bitmap) {
            // The cache size will be measured in kilobytes rather than
            // number of items.
            return bitmap.getByteCount() / 1024;
        }
    };

}

应用程序崩溃时出现以下堆栈跟踪 11-07 12:56:37.807 15516-15516/com.laer.easycast D/AndroidRuntime﹕ Shutting down VM< 11-07 12:56:37.817 15516-15516/com.laer.easycast E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.laer.easycast, PID: 15516 android.support.v4.app.SuperNotCalledException: Fragment ImagePane{64e8db70 id=0x7f090001} did not call through to super.onCreate()

知道它有什么问题吗?我努力了......

0 个答案:

没有答案