Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Add buttons on app MQTT PAHO(Include ON and OFF button in app MQTT)
Add buttons on app MQTT PAHO [message #1708370] Wed, 16 September 2015 03:36 Go to next message
Jeff August is currently offline Jeff AugustFriend
Messages: 10
Registered: September 2015
Junior Member
Hello everyone.

I am having difficulty grade to include buttons in the application MQTT app . By the way a great example for using MQTT service. But in my application I wish there was a toogle button to upload the topic and message.

I tried to include the button on activity_publish and add a View.OnClickListener the Listener class, but without success. I think I can not include button treatment in Listener class.

Anyone have any suggestions ?

I just wanted to have a button to send topic " Led " Message " ON" , for example.

Thanks!

Regards,

Jeff
Re: Add buttons on app MQTT PAHO [message #1708408 is a reply to message #1708370] Wed, 16 September 2015 10:47 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 65
Registered: July 2015
Member
Hi Jeff,

It sounds like the easiest way would be to add your button to the menu. In Listener.java, onMenuItemClick shows how publish() is called. You could implement your publishLedOn method and include it in the switch statement. Then just add an item in activity_publish.xml in res/menu.

Good luck!

James
Re: Add buttons on app MQTT PAHO [message #1708492 is a reply to message #1708408] Thu, 17 September 2015 07:05 Go to previous messageGo to next message
Jeff August is currently offline Jeff AugustFriend
Messages: 10
Registered: September 2015
Junior Member
James , thanks for replying to my topic.

I'm trying to work here. So far without success. Sad But as soon as there is any news , I will publish here.

Again , thanks for the suggestion!

Jeff
Re: Add buttons on app MQTT PAHO [message #1708759 is a reply to message #1708492] Sun, 20 September 2015 14:08 Go to previous message
Jeff August is currently offline Jeff AugustFriend
Messages: 10
Registered: September 2015
Junior Member
Hi,

I've been messing with the home app and saw that a simple solution could be I use the same menu / publish button with a possible toogle function. So that within the publish () method could be an IF to test the current condition of the topic. If it is ON, it publishes OFF, if OFF, ON sends the broker.

The current topic of the status information is in MqttCallBackHandle / Class in notifyArgs variable [1 ] .

I ask , how can I use it within publish () ?

Something like :
Publish ( )
If ( notifyArgs [1 ] ) equals ( ON) ) {
Publish OFF}
else {
Publish ON}
Previous Topic:Link DLL to C project for an embedded system
Next Topic:Paho Java Eclipse Utility
Goto Forum:
  


Current Time: Fri Nov 24 11:26:00 GMT 2017

Powered by FUDForum. Page generated in 0.02162 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software