作者freedom74569 (莫急莫慌莫害怕)
看板java
标题[问题] 有关於Arraylist拿不到值
时间Mon Dec 28 13:43:54 2015
我implements library然後使用里面的fuction
//宣告ArrayList mDevices1
public ArrayList<BluetoothDevice> mDevices1 = new ArrayList<BluetoothDevice>();
//使用library function,还是这里会做在library package里面,这样让我取不到?
@Override
public void bluetoothDeviceListBeenRenewed(BluetoothList bluetoothList) {
//mDevices1 = bluetoothList;
mDevices1.addAll(bluetoothList);
// 这里打印的出来mDevices01,而且bluelist确定有东西也有打印出来
Log.e("mDevices1", String.valueOf(mLeDevices1));
}
我只有在这个function印得出来mDevices1,
不过在 其他地方 要拿来用,
就拿不到mDevices1就为空的阵列
存不回去上面宣告的mDevices1那
我想问看看有什麽关键字!
现在完全没有方向...
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.225.162.37
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/java/M.1451281438.A.6CB.html
1F:→ yyc1217: 是mDevices1还是mLeDevices1? 12/28 20:20
2F:→ freedom74569: 抱歉~已更正 12/28 21:15
※ 编辑: freedom74569 (61.230.74.188), 12/28/2015 21:15:36
3F:推 gmoz: 其他地方确定有先call过了吗? 不然先单步执行看看吧 12/28 21:22
4F:→ freedom74569: 请问一下单步是什麽意思~ 12/28 22:27
5F:→ kurakidream: BluetoothList 真的放的进 mDevices1里面吗 @@? 12/28 22:53
6F:→ kurakidream: 而且你想想 Log.e真的print出它里面放的东西吗? 12/28 22:58
7F:→ freedom74569: kurakidream 放不进去..有点不知道怎麽办 12/28 23:59
8F:→ freedom74569: 在这个function放进~不过只能在这fuc里... 12/29 00:01
9F:推 gmoz: 没有这种事情的 应该是逻辑上有地方错误 12/29 10:44
10F:→ freedom74569: 是的,是在不同线程,抓到问题了 12/29 23:43