sendBroadCast好像需要context才行啊,普通线程如何去调用这个接口呢?

解决方案 »

  1.   

    // send information to update view
    Intent intent1 = new Intent(Common.MUSIC_LIST_RECEIVER);
    intent1.putExtra("count", mCursor.getCount());
    intent1.putExtra("artistArray", artistArray);
    intent1.putExtra("titleArray", titleArray);
    intent1.putExtra("durationArray", durationArray);
    sendBroadcast(intent1);
    参考代码,直接用一个intent做参数,执行sendBroadcast就可以了,接收方通过Common.MUSIC_LIST_RECEIVER区分是哪个广播
    需要在manifest中注册广播
      

  2.   

    普通的线程类没有sendBroadcast接口吧...
      

  3.   

    只要已有操作就会通知到BroadcastReceiver类的receive()方法,貌似不需要线程啊
      

  4.   


    问题是我要这个线程里广播自定义的消息,而我想问的是如果能让普通的线程类调用到sendBroadCast方法
      

  5.   

    引用 1 楼 ameyume 的回复
      

  6.   

    sendBroadcast是系统的东西,到处都可以用
      

  7.   


    在 线程启动之前 可以先把 context作为参数传进来么
      

  8.   

    同问,我想在powerui.java中发送一个广播,却报错,找不到该方法