منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
?how i can add items in adapter from other thread class كيف اضيف عنصر الى adapter - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغات البرمجة الاخرى (http://vb4arb.com/vb/forumdisplay.php?fid=4)
+--- قسم : قسم لغة Java (http://vb4arb.com/vb/forumdisplay.php?fid=17)
+---- قسم : قسم اسئلة Java (http://vb4arb.com/vb/forumdisplay.php?fid=22)
+---- الموضوع : ?how i can add items in adapter from other thread class كيف اضيف عنصر الى adapter (/showthread.php?tid=7978)



?how i can add items in adapter from other thread class كيف اضيف عنصر الى adapter - fared wahed - 15-03-13

اذا استخدمت هذا الكود يظهر لي خطا في الthread فماذا افعل لهذا الكود حتى يعمل ؟؟ ممكن مساعدة :confused:
كود :
/* this is the class which i wont to add item for adapter*/

    public class ADDmess extends Thread {
    DiscussArrayAdapter adapter;
    ADDmess(DiscussArrayAdapter adapterIn){
    adapter=adapterIn;
    }
    public void run() {
    adapter.add(new OneComment(true,"HELLO"));
    }

/*this is in the main activity when i pass button*/
    
    private DiscussArrayAdapter adapter;
    private ListView lv;
    lv = (ListView) findViewById(R.id.lstLocalMess);
    adapter = new DiscussArrayAdapter(getApplicationContext(), R.layout.listitem_discuss);
    lv.setAdapter(adapter);
    
    new ADDmess(adapter).start();