android - passing values from a receiver to a button -
i have broadcast receiver "intentfilter(bluetoothdevice.action_found)", , registered in onstart , unregistered in onstop. , in layout have a button turn bt on/off , button "btndiscover" when pressed should display information state of discovered devices contained in object "stateextdevice" shown belwo in code of broadcast reciever:
broadcast receiver:
switch (action) { case bluetoothdevice.action_found: log.d(tag, logand.show("onreceive", "bluetoothdevice.action_found")); int stateextbond = intent.getintextra(bluetoothdevice.extra_bond_state, bluetoothdevice.error); switch(stateextbond) { case bluetoothdevice.bond_bonding: log.d(tag, logand.show("onreceive", "bond_bonding")); break; case bluetoothdevice.bond_bonded: log.d(tag, logand.show("onreceive", "bond_bonded")); break; case bluetoothdevice.bond_none: log.d(tag, logand.show("onreceive", "bond_none")); break; } bluetoothdevice stateextdevice = intent.getparcelableextra(bluetoothdevice.extra_device); //setbtdeviceextrs(stateextdevice); adapter.add(stateextdevice.getname()+"\n"+stateextdevice.getaddress()+"\n"+stateextdevice.getbondstate() +"\n"+stateextdevice.gettype()+"\n"+stateextdevice.getuuids()); adapter.notifydatasetchanged(); break;
the problem when onpause state activate bt manually, broadcast receiver goes "case bluetoothdevice.action_found" , display information without button being pressed, , want these information displayed when button "btndiscover" pressed. thought of solving issue using setters , getters methods, question problem solved interface example? , there better solutions
Comments
Post a Comment