Code example for ArrayAdapter

Methods: add

0
        super.onDestroy(); 
        unregisterReceiver(mReceiver);
    } 
 
    private void addMsg(String msg) {
        mMsgAdapter.add(msg);
        Log.d(TAG, "msg");
    } 
 
    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override 
        public void onReceive(Context context, Intent intent) { 
            if (intent == null) 
                return; 
            String action = intent.getAction(); 
            if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) { 
                String stateStr = "???"; 
                switch (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothDevice.ERROR)) { 
                    case BluetoothAdapter.STATE_OFF: 
                        stateStr = "off"; 
                        break;