ActionBarCompat和片段

时间:2014-01-07 17:40:20

标签: android android-fragments

我开发了一个带有片段和动作栏的应用程序,但只有在我完成后,我才发现它不适用于Android版本< 3.0!现在,我已经阅读了support.v7和ActionBarCompat,但我在logcat中遇到了这些错误:

01-07 10:52:15.160: E/StrictMode(873): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
01-07 10:52:15.160: E/StrictMode(873): java.lang.Throwable: Explicit termination method 'release' not called
01-07 10:52:15.160: E/StrictMode(873):  at dalvik.system.CloseGuard.open(CloseGuard.java:184)
01-07 10:52:15.160: E/StrictMode(873):  at android.drm.DrmManagerClient.<init>(DrmManagerClient.java:258)
01-07 10:52:15.160: E/StrictMode(873):  at com.google.android.mms.pdu.PduPersister.<init>(PduPersister.java:288)
01-07 10:52:15.160: E/StrictMode(873):  at com.google.android.mms.pdu.PduPersister.getPduPersister(PduPersister.java:296)
01-07 10:52:15.160: E/StrictMode(873):  at com.android.mms.transaction.TransactionService.onNewIntent(TransactionService.java:224)
01-07 10:52:15.160: E/StrictMode(873):  at com.android.mms.transaction.TransactionService$ServiceHandler.handleMessage(TransactionService.java:621)
01-07 10:52:15.160: E/StrictMode(873):  at android.os.Handler.dispatchMessage(Handler.java:102)
01-07 10:52:15.160: E/StrictMode(873):  at android.os.Looper.loop(Looper.java:136)
01-07 10:52:15.160: E/StrictMode(873):  at android.os.HandlerThread.run(HandlerThread.java:61)

我该如何解决?

更新: 这是我的一段代码:

public class MainActivity extends ActionBarActivity implements ActionBar.TabListener {
    AppSectionsPagerAdapter mAppSectionsPagerAdapter;
        ViewPager mViewPager;
        int mCurCheckPosition;

        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            setContentView(R.layout.activity_main);        

            this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 

            mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

            Log.d("1","ok");

            final ActionBar actionBar = getSupportActionBar();

Log.d( “1”, “OK”);不在我的logacat

0 个答案:

没有答案