2012-10-29 60 views
0

我使用的目標API 16和最低的API 11與編譯器1.7的合規性級別 當我在LoaderCallbacks的方法(如OnLoadFinished,OnCreateLoader)上使用@Override表示法時,檢查結果說我必須重寫超類方法。loadermanager.callbacks覆蓋符號

的Eclipse SDK

版本:4.2.1 版本ID:M20120914-1800

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.birthdays" 
    android:versionCode="1" 
    android:versionName="1.0"> 

    <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="15" /> 

    <application android:label="@string/app_name" 
     android:icon="@drawable/ic_launcher" 
     android:theme="@style/AppTheme"> 

    </application> 

</manifest> 



public class MainActivity extends ListActivity implements LoaderManager.LoaderCallbacks<Cursor> 
    { 
     private static final int ACTIVITY_CREATE = 0; 
     private static final int DELETE_ID = Menu.FIRST + 1; 
     private AppSqliteDataBase dataSource; 
     private Cursor cursor; 
     private SimpleCursorAdapter adapter; 
     public void onCreate(Bundle savedInstanceState) 
     { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.main); 
    //  this.getListView().setDividerHeight(2); 
      dataSource = new AppSqliteDataBase(this); 
      dataSource.open(); 
      cursor = dataSource.getCursor(); 
      fillData(); 
      registerForContextMenu(getListView()); 


     } 

     private void fillData() 
     { 
      String[] from = new String[] { dataSource.getCredentialsColName() }; 
      int[] to = new int[] { R.id.list_label }; 
      adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, cursor, from, to, 0); 
      setListAdapter(adapter); 

      getLoaderManager().initLoader(0, null, this); 
     } 

     public Loader<Cursor> onCreateLoader(int id, Bundle args) 
     { 
    //  String[] projection = { dataSource.getIdColName(), dataSource.getCredentialsColName() }; 
      SQLiteCursorLoader cursorLoader = new SQLiteCursorLoader(this, 
        dataSource.dbHelper, "select _id, credentials from birthdays where 1", new String[]{}); 
      return cursorLoader; 
     } 


     public void onLoaderReset(Loader<Cursor> loader) 
     { 
      adapter.swapCursor(null); 
     } 


     public void onLoadFinished(Loader<Cursor> loader, Cursor data) 
     { 
      adapter.swapCursor(data); 
     } 
    } 

回答

0

改變你的編譯器合規水平1.6, 右鍵點擊您的項目在日食進入屬性選擇編譯選項