开发者

Honeycomb and startManagingCursor

private DbAdapter_Task task;
 pr开发者_开发百科ivate DbAdapter_Assignment assignment;
 private DbAdapter_User user;
 LinearLayout linear;
 TextView text;
 ListView list;

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String empid = getIntent().getExtras().getString("EmpID");

        assignment =  new DbAdapter_Assignment(getBaseContext());
        assignment.open();

        Cursor cursor = assignment.numOfNewTask(empid);
        startManagingCursor(cursor);

        linear = new LinearLayout(this); 
        linear.setOrientation(LinearLayout.VERTICAL); 

        text = new TextView(this);
        text.setText(Html.fromHtml("<H1>" + "You have " + Integer.toString(cursor.getCount()) + " new assignments." + "</H1>"));

        list=(ListView)findViewById(R.layout.listlayout);
        SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.listlayout, cursor,         
                new String[] {"TaskID"}, new int[] { R.id.text});  
        list.setAdapter(adapter);

        linear.addView(text);
        linear.addView(list);
        setContentView(linear);     
 }

I am developing in Honeycomb. How should I use CursorLoader instead of startManagingCursor ?


startManagingCursor is deprecated in honeycomb and will most likely crash the application if you try and use it. You are better off using a CursorLoader

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜