I want to add the countries and their corresponding States in android application locally, in such a way that when the user clicks on the country a dialog should come up and it should show a list of country names, and when the person selects a country, in the state dialog it should show the corresponding state names.
I have a list( in xml format ) for all the country and their states but i am unable to use them in my android app and also do not know the way how to use them.
Please help
you can do like wheel demo like iphone default spinner,
I have a link which has the same concept like you want. but yes it has not been entered all the list of country and their state. but on that you can find the way how to get it.
http://code.google.com/p/android-wheel/
For Country and it's state detail you have to find out in google that any default methods provides to get all countries and their states or otherwise you have to add it manually add it by country wise I have the link that has list of country and it's states.
http://en.wikipedia.org/wiki/List_of_countries_by_population
hope it will help you.
Related
I try to make an app on Android for services reviews, every review is save like an element in the document "user" like this-
Everytime the user save a report I have see if inside the reports the field "plate" is existing comparing with the new one, I try query using the examples in the page arrays in Firebase
In the code i tried get with "whereEqualTo" method search by "reports.plate" or with the method "whereArrayContains" with the same field (the filter uid exits but in the first image doesn't show) any idea how i can search the document when some of the custom elements fields is equal
maybe sorry in advance for the english i'm practicing
Thanks in advance
I have successfully added a word to Android's predefined user dictionary, but i want to create a custom dictionary which can only be accessed by my application.
For example: When i type "lol", the suggestions show me "laugh out loud" but when I want another meaning of "lol" then I can manually add another meaning of "lol" (eg, "xxxxxx" - so the next time the user writes "lol" in an EditText, the suggestions will show him "xxxxxx").
No other application should have access my dictionary data.
I have worked with spell checker class but it gives me only correct word and I can't my own word meanings.
Please give me some suggestions or links.
There is an Androids inbuilt class UserDictionary so that you can add your spells programmatically into that, Here is a link you can go through with , and which may relates to your problem .(In this solution nidhi has manged programmatically to retrieve data back)
Add word to user dictionary and retrieve them back from dictionary
In addition you can go through following links to :
http://developer.android.com/reference/android/provider/UserDictionary.html
http://developer.android.com/reference/android/provider/UserDictionary.Words.html
Moreover if you want a custom personal dictionary then manually you have to store words and retrieve them back .
Hope that helps !!!
I have an android app which displays quotes and have navigation to go to next quote and so on. would like to add "Save Quote As favourite" based on users selection of particular quote.
Once user saves Fav quotes and wants to see those quotes only, app should show those quotes.
Currently app reads the quotes from XML file. Let me know if any more information is required to understand the problem.
I would provide every quote with an ID (int). Whenever the user selects a quote to be a favourite, that ID is saved to a Set of integers. Later on if user decides to show favourites, you fetch all quotes with your IDs from the Set and show them in a appropriate view, for example a ListView
If you have a Quote class or something like that, you might as well put them in a collection whenever user decide his favourites, and show them in a ListView with a custom adapter.
I need to fill up my Spinner with Time zones EXACTLY like it filled in settings -> date&time -> select time zone menu. If I use just
TimeZone.getAvailableIDs();
I get complitly different view. I.e. in settings menu it looks like:
Midway Island
Hawaii
Alaska
...
in my spinner I get
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
....
In Android, Settings app translates from the ids to common names. you can find the xml that is used for translation is here
http://grepcode.com/file/repository.grepcode.com$java$ext#com.google.android$android-apps#4.0.4_r1.2#packages$apps$Settings$res$xml$timezones.xml
.
So you will also have to translate it to common names programmatically
Once you have the ids, you need to use TimeZone.getTimeZone(id).getDisplayName() in order to see the names in the format used in the Android settings. Be aware though that some of the ids result in the same display name so you'll need to filter items that have the same display name.
I'm working on application and I need some suggestions which is the best way to code it for Android. Basically it's something like event guide for a few cities. Imagine this :
I have an activity with 7 different buttons (7 different cities) and clicking on one of these buttons I'm opening a new activity where I have all months (January-December) as buttons again. If there is some event in February for example in the chosen city the button will be active and I will go to another activity where I have a list with the events. So my idea is to do it in this way :
Create one Activity with all Cities
Create one Calendar activity with all months.
When user select for example Paris, I'll send an extra via intent with an ID of the chosen city :
intent.putExtra("chosenCity", 2); //something like this
In the Calendar activity I will make active/inactive months buttons depending on that extra sent from Cities activity.
And when user chose a month I will send that chosenCity extra again to the ListViewEvents activity and populate the list view from Database (for example) depending on that extra.
So my question is : is it a good way to build an application like that? Or if it's not, which is the best way to achieve this?
Thanks in advance!
Sounds like you already know pretty much what you need to do. The only thing left is to implement it. The only thing I'll add is that your should probably store all your database and use a CursorAdapter to display them in the ListView. You can store all the events in the database and just create your select statement in such a way that it only selects the events you want to display at any given time. When using this CursorAdapter, I highly recommend you use the CursorLoader.