Android 如何修复不推荐的:startManagingCursor()
我有一个关于绝望的密码Android 如何修复不推荐的:startManagingCursor(),android,android-loadermanager,android-loader,Android,Android Loadermanager,Android Loader,我有一个关于绝望的密码 startManagingCursor(timelineCursor) 那个代码不再有效,但我必须如何使用loadmanager更改我的代码,我读了一些博客,但我仍然感到困惑。你能给我举个例子吗 这是我的全部代码 setContentView(R.layout.timeline); try { homeTimeline = (ListView)findViewById(R.id.homeList); //instan
startManagingCursor(timelineCursor)
那个代码不再有效,但我必须如何使用loadmanager更改我的代码,我读了一些博客,但我仍然感到困惑。你能给我举个例子吗
这是我的全部代码
setContentView(R.layout.timeline);
try {
homeTimeline = (ListView)findViewById(R.id.homeList);
//instantiate database helper
timelineHelper = new NiceDataHelper(this);
//get the database
timelineDB = timelineHelper.getReadableDatabase();
//query the database, most recent tweets first
timelineCursor = timelineDB.query("home", null, null, null, null, null, "update_time DESC");
startManagingCursor(timelineCursor);
//instantiate adapter
timelineAdapter = new UpdateAdapter(this, timelineCursor);
//this will make the app populate the new update data in the timeline view
homeTimeline.setAdapter(timelineAdapter);
//instantiate receiver class for finding out when new updates are available
niceStatusReceiver = new TwitterUpdateReceiver();
//register for updates
registerReceiver(niceStatusReceiver, new IntentFilter("TWITTER_UPDATES"));
Toast.makeText(getApplicationContext(), "teest", Toast.LENGTH_SHORT).show();
//start the Service for updates now
this.getApplicationContext().startService(new Intent(this.getApplicationContext(), TimeLineService.class));
}
catch(Exception te) { Log.e(LOG_TAG, "Failed to fetch timeline: " + te.getMessage()); }
装载机机架一旦发生故障就不难理解。您将需要使用管理器以及一组您自己的自定义回调。这篇文章应该会有所帮助