How do you change button name using long press in apk?

Hi all , I make apk on off relays , it have 8 buttons, I generate apk , it's works good , every time I want to make changes when I want to rename buttons , I rename buttons from MIT inventor and generate new apk , to make easy to me , how I can rename buttons by long press in that button from apk itself ???? Is that possible??? Any help ? Thanks in advance

Do you mean to change the text on the button?

Try this (it is a bit long winded, there is probably an easier way)

LongPressButtonChange.aia (3.6 KB)

uses a predetermined list for the user to select a text for their button. changes are saved to tinydb across app uses. If you want to add bespoke or new text to a button, use a notifier text dialog to enter the text you want, and save this to the tinydb

1 Like

Yes , to change text in button .. I'm using firebase database

How I do that with firebase database ?

I see this aia file you send to me, I want change button names not from options names , I want to put new name I type it manually and it save it , I have 8 buttons relays , I want like change button 1 name to living room , or to kitchen , or ... depend we're I put the relay , so I want long press and rename button as I like , and the app save the name . I use firebase database with my project . Any idea ??

I don't see why you would need an online database for such a customized project.

1 Like

Brother I do that for controlling nodemcu using app and web interface too real time , that's why I use firebase , I'm just face this problem how I'm just rename buttons using Ling press from apk .

As I suggested, use the notifier text dialog to enter the button name you want, set the button text, and save this setting to tinydb.

Given that you are coordinating data through FireBase, you would probably need to map what you call button Names against branches of your FireBase tree, assuming you track each device in a different branch off the root of the tree, and attributes and controls of each device under that branch?

TinyDB is a good place to keep those mappings between runs.

I posted a FireBase dump utility at

recently, if you need one.

Please make it simple , how I rename any button by long click on it?

Try this:

LongPressButtonChangeNotifier.aia (3.5 KB)

I reworked the listpicker approach to a notifier text dialog.

BLOCKS

1 Like

The .aia is in the post I linked.

Thanks brother , it's called tiny dB, can I use firebase ? Just change tiny to firebase ? Does when I change name button in my android phone , it will changed in my wife phone too ?? Become I want install apk in two phones , I will put button 1 name : living room , so I can on off that room from apk , so when I change the name in my phone , it should changed in my wife phone when she run apk too , so I use firebase database real-time database so I know the living room is on or off from two phones or more . Now my question is the .ino file you send to me ( button name change ) by long press works , but can it send that name changed real-time to firebase ? So when I open another phone , I will see it's named is changed ?? If not can you make this function ?

For such a tiny amount of data you do not need Firebase - try using TinyWebDB, which is essentially TinyDB in the Cloud.

1 Like

Try this, uses Firebase realtime database to store the button text data. The same app on different devices will get the current button text settings on startup, and will update should any change be made while the app is open on multiple devices. Keep the buttons and data in the same order !

LongPressButtonChangeNotifierFB.aia (4.1 KB)

Make sure you enter your own firebase url
image

This is how the data looks on the firebase console. "Relays" is the parent node (ProjectBucket)
image

BLOCKS

1 Like

Thanks brother , I will try ..