Hello people can someone help.
I have designed a dialog in which I would like to have a field box or some sort that when the dialog is called the TYPE & AMOUNT (link) box's will display the data from database on each item. So for this dialog I have made. The user will click drinks button on the activity before the dialog. And the data will fill theses field boxes once called.
My question is what can I use for this data box caller.
You can use TextView or EditText widget (depending on if you want user to just see or edit the data respectively) and you can pull data from SQLite Database.
Related
I would like to get id from dialog box after user select text that populated in dialog box.
How can I populate data with hidden id to dialog box from web service?
Based on the info you gave, I'm guessing you want something like
EditText dialogBox = (EditText) findViewById(R.id.yourDialogBox);
int id = dialogBox.getId();
If you are referring to an actual Dialog object, I do not see any way to directly reference the ID of the dialog other than possibly
yourDialogObject.getOwnerActivity().getTaskId();
Without more info it is hard to say what exactly you are looking for.
I'm trying to build a user input form in Android by displaying the following input views on an activity screen:
Spinner (Get a location from pre-filled options)
EditText (Get exact address)
Spinner (Get 2nd location from pre-filled options)
EditText (Get exact address)
Date
Time
Now, I want to allow the user to fill the above fields only in the particular order mentioned above, eg. user should not be able to see options in 2nd spinner unless she selects one from the 1st spinner, or user should not be able to fill EditText fields before selecting option from spinners...
How can we ensure this?
I am quite new to Android development. I managed to get data saved to SQLite database. Now, what I want is to view these data when I call viewData(). I have viewData() which shows data as a Toast as I made it as a sample. Now I need these data to show on a new activity but the number of data to show is depending on how many data is in the database at the moment, If user saved 10 items then I want all the 10 items to shown up. How can I do it?
What is the best way to show data from SQLite database on an activity. Since I don't know to use ListView, I used TableLayout on the other activity where user feed data.
I hope my question is clear.
Thanks in advance.
I am writing simple login activity.
I have login edit text and password edit text.
I am kepping login and pasword via sharedpreferences.
I want to make login field to rember previous logins (eg "aaa" and "aab") so when you type in edit text it give you some options and you can choose them to outo complite it.
How it can be done?
You should use AutoCompleteTextView instead of simple EditText
check dev link http://developer.android.com/reference/android/widget/AutoCompleteTextView.html
also check this link for detail http://www.javatpoint.com/android-autocompletetextview-example
You can use AutoCompleteTextView for the login field, and use a suitable adapter to display the values. If you are remembering the previous login IDs, then, you can store them in SQLite DB and use CursorAdapter to populate the auto complete text view.
In my Application I want to Add and Remove View (like Button, or Textview, Checkbox ) by Coding (Programming ).
In Details:
I have One EditText and One Add Button. User Enter Anything in EditText and Press the Add Button then this one is added in bellow LinearLayout, and whether User click on his/her added Button it will going to next LinearLayout.
I get sucess upto this.
but when user click the button in second LinearLayout then it will come back on first Linearlayout. I am getting error Here, i don't know where I made a Mistake.
And I also facing Problem about how can I Store this all. Like User Add 5 Button and closed the application and whenever he/she came back to application I need whatever he/she previously added.
Here is what i done.
http://dynamicandroidview.blogspot.com/2011/12/how-to-add-view-in-android-by-coding.html
Try to create a database table with minimum 2 columns in your case it will be id and buttonText.
Now when user clicks on the add button it will save text to the database and will create the button dynamically below any buttons which are already created before or as a new button.
Now in your onCreate method get the count of text thats stored in database.Some thing like the following code:
DB getData = DB.getInstance();
getData.open(this);
ArrayList<TextHolder> getList = new ArrayList<TextHolder>();
getList = getData.getAllTextFromGeT();
getData.close();
x = genList.size();
Here x will be the number/count of elements that are already stored in the database.Now you can another int say i and using this i and x in the for loop you can create buttons dynamically.
Inside the loop you can do something like the following to get text for all the buttons that are being created:
TextHolder firstOne = getList.get(i);
String text = firstOne.getText();
You will also need class with getters and setters method in order to convert DB elements into objects.Like in the above code getText() is our getter method which is getting elements from database and returning it here.
here text will be the text of the button.
So every-time users starts the application he will see all the buttons that he created when he ran the application before and newly added button will appear on the spot and also will be stored in the database for future retrieval.
Remember we are just storing text of the button and assigning it unique id which helps us to create the buttons.Hope this helps