assigning a unique id for button [closed] - android

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
suppose there exist a form and has two button ,i want one button to get disabled until all parameter is filled by user while other Enabled,for users to navigate to back panel.Is there exist a function to assign unique id to buttons?
Edit1: Tried to disable one of the button,until all the text-form field in the page is touched by users,once user enters all the required parameters ,then the button gets enabled!

You don't need a unique id for that
FlatButton(Text('foo'), onPressed: areAllParametersFilled ? _onFooPressed : null),
FlatButton(Text('bar'), onPressed: !areAllParametersFilled ? _onBarPressed : null),

Related

AutoCompleteTextField itemFilter in Flutter [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have a list of courses and I need to filter them while searching
I need to be able to search for every word the user enters
For example: if I have course called nutrition basics, If I enter in search bar basics nothing show up but if i enters nut or even n it works.
Here is my code:
itemFilter: (suggestion, input) => suggestion.name .toLowerCase() .startsWith(input.toLowerCase()),
How can I do the filter as I want? I need to search even if for letter 'b' and still get the result nutrition basics.
I'm using flutter and firebase.
Note: I tried contains insteadof startWith, but if i have two courses one nutrition basics and other math 500 basics and i searched for word basics the result shows after enter is only nutrition, also i need to be able to search for letters too, as b in basics or c..
Thanks.
You have used method startsWith
itemFilter: (suggestion, input) => suggestion.name .toLowerCase() .startsWith(input.toLowerCase()),
use contains instead of startsWith
itemFilter: (suggestion, input) => suggestion.name .toLowerCase() .contains(input.toLowerCase()),

How do I see all my data that has been read in Cloud Firestore? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have successfully read all my user data into cloud firestore but unable to see all my data in one go.
As you can see in the screen capture, "Sara" has been read. Beforehand, "Mira" and "Kiena" has also been read.
How do I see "Mira" and "Kiena" together with "Sara" in one screen? I want to see all the data that has been read in Cloud Firestore.
I need to have all this as a record for my thesis.
I set the user data with this code:
private DocumentReference mDocRef = FirebaseFirestore.getInstance().document("sampleData/userdata");
You need to add this
SetOptions.merge()
inside the set function in your code
what is happening now is that firestore takes a key = name and values = sara/mira/etc and keeps overriding the values since the key is the same, but when you use the merge options it will not override and will display all in a list
It looks like you're setting the user data with something like:
db.collection("sampleData").document("userData").set(...)
Any time you execute this code, you're overwriting whatever data already exists in userData.
If you want to create a new document each time you run the code, do:
db.collection("sampleData").add(...)
This will generate a new document with a unique ID each time you execute it.
If the document needs to be associated with the current user from Firebase Authentication, you'll want to use the user's UID as the document name. That'd look like this:
String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
db.collection("sampleData").document(uid).set(...)

I want to display the phone number entered by user during signup in the next activity [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
i.e when the user enters his/her phone number ,the next activity should say : WE HAVE SENT AN OTP TO YOUR NUMBER ( WHERE INSTEAD OF NUMBER , IT SHOULD DISPLAY THE PHONE NUMBER ENTERED BY USER ) FOR MY ANDROID APP
open a new activity and send data through intent like this in your first activity :
val intent = Intent(context, MySecondActivity::class.java)
intent.putExtra("phoneNumber", myPhoneNumber)
context.startActivity(intent)
then in your second activity in onCreate():
phoneNumber = intent.extras?.getParcelable("phoneNumber")

Regular expression for song name in android [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
In my application I want to display the song's name. Now it is showing the entire song path, like this
String song_name = /storage/Music/Lean on.mp3
but I want to display only the song's name, that means
String song_name = Lean on.mp3
Can any one help me with the regular expressions used for extracting the name of song from the file path?
You can use subString function with combination of LastInedexOf function.
please find below example
String path=":/storage/Music/Lean on.mp3";
String filename=path.substring(path.lastIndexOf("/")+1);

How do I return an int from EditText and than show that number in Toast? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am a beginner at programming Android, please help with this simple project.
I want an integer to show up in toast, which I write in textBox. I do not know what to put in the highlighted part here.
Sorry for the link, but I cannot post the picture
You need to use the getText() method to get the text the user entered.
Change the myEdit declaration to:
final EditText myEdit = ... ;
and then use:
Toast.makeText(MainActivity.this, myEdit.getText().toString(), ...

Categories

Resources