Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    88

    City and Country - User Profile

    Hi people,
    I am developing an application using Java 2 Me. In my application the user has to fulfill a profile.
    Now, the user types the country and city where he is from using TextField. But I would like to improve it.
    Is it possible to get a list of all the countries and after choosing a country to get the list of all the cities of the chosen country?

    I was thinking something like that:
    using a ChoiceGroup.POPUP for all the countries - when the user choose one (for example Denmark), another ChoiceGroup.POPUP will be visualized and It will give the opportunity to choose all the danish cities.

    is it possible to get these lists somewhere?

    thanks
    antonio

  2. #2
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Sri Lanka, Colombo
    Posts
    204

    Smile Re: City and Country - User Profile

    hi antonio5982,

    first of all u shuld keep in mid that you are developing for a small phone.......

    so code should be optimize....

    hw mny countries are there in this world....

    it will be difficult to show all the countries in a phone screen...

    and if you really want to show the countries in a choice group OK no issues.... but why do you want another choice group to display the country code..

    it's useless. use a map where country code maps with the country....

    cheers,
    Randika

  3. #3
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: City and Country - User Profile

    Quote Originally Posted by HasithaRandika View Post
    hw mny countries are there in this world....
    around 250 to 300 which will occupy around 4KB in jar file

    Quote Originally Posted by HasithaRandika View Post
    it will be difficult to show all the countries in a phone screen...
    Not if there is a List with TextBox for free text search. But its somewhat tedious to build this on Canvas in J2ME since there is no such in-built feature...

    Quote Originally Posted by HasithaRandika View Post
    and if you really want to show the countries in a choice group OK no issues.... but why do you want another choice group to display the country code..it's useless. use a map where country code maps with the country....
    I didn't read "country code" in antonio5982's post... its city and not country code... and it makes perfect sense to display a list of cities once country is selected...

    Quote Originally Posted by antonio5982 View Post
    Is it possible to get a list of all the countries and after choosing a country to get the list of all the cities of the chosen country?
    Yes... just google and you will get it...

    Quote Originally Posted by antonio5982 View Post
    using a ChoiceGroup.POPUP for all the countries - when the user choose one (for example Denmark), another ChoiceGroup.POPUP will be visualized and It will give the opportunity to choose all the danish cities.
    I recommend you not to give any list because:
    1. It is not good to give list of 250 countries without free text search feature
    2. It is very tedious to code free text search in J2ME
    3. List of cities will occupy much more space

  4. #4
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    88

    Re: City and Country - User Profile

    Hi HasithaRandika,

    thanks for you reply

    I want to help the user to insert the country and city in order no to have mistakes into the database. (ex: a user could insert as city Copenhagen and another user København - So it will not be useful for some search option).

    This one was the main reason why I would like to have the lists of Countries and Cities.

    Probably you solution is more elegant in a mobile phone. Could you please give me more information how to use a map with country code?

    thanks again
    antonio

  5. #5
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    88

    Re: City and Country - User Profile

    Hi arpit2agrawal,

    thanks for your reply.

    I was also thinking about text search feature, and I have just understand that I could do it using TextBox object.

    I just have one more question, instead of storing the lists in the memory of the mobile phone, is there some way to get them from internet when they are needed?

    I mean, I open an HTTP connection when I need the list of countries.... is it possible to get this list somewhere on internet?

    thanks again
    antonio

  6. #6
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: City and Country - User Profile

    Quote Originally Posted by antonio5982 View Post
    I mean, I open an HTTP connection when I need the list of countries.... is it possible to get this list somewhere on internet?
    Yes, you can do that.
    Just google and get that list. Then you could put this list on your web server and get it from there at run time using http connection. 10 MB web hosting space with domain name costs less than US$20 per annum.

  7. #7
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    88

    Re: City and Country - User Profile

    hi arpit2agrawal,
    you were talking about "TextBox for free text search", I was looking on the API but i did not find the way to do it.
    Please could you give me more detail information how to do the TextBox for free text search?

    thank you
    antonio

  8. #8
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: City and Country - User Profile

    There is no build-in API for that. You will have to make following 2 components on a Canvas:
    1. A "List" for displaying list of countries/city at the top occupying approx. 80% of the screen
    2. A "TextBox" for free text search at the bottom occupying approx. 20% of the screen

    Note that the terms used above viz. "List" and "TextBox" has no relation with the List and TextBox class in the MIDP specifications. Don't confuse between them.

    For building above components you will have to use following APIs:
    1. keyPressed
    2. keyRepeated
    3. drawString
    4. drawRect
    5. fillRect
    etc.

Similar Threads

  1. Get city longitude and latitude - how?
    By gosuwachu in forum Symbian
    Replies: 0
    Last Post: 2008-09-23, 14:42
  2. Home city/country
    By mobi1 in forum Symbian
    Replies: 9
    Last Post: 2007-09-10, 09:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×