0

I know there are questions about sql databases, and things like that. i have been searching through the site for something that'll help, but it's only confusing me further. I'm reluctant enough to ask here, as the last time i asked for a nudge in the right direction, the question got closed because i didn't post up code.

I'd post some if i even knew where to begin.

But i digress.

I'm looking for the best (easiest?) way to do this:

Small interface, drop down menu with list of names, when a name is selected, it shows a small list of details about the selected name.

here i mocked up the basic idea in dreamweaver:

enter image description here

ideally it would call up the user info as needed.

I have no idea how to make something like this for android (or..at all really). Would anyone have any tutorials or can you point me in the right direction?

Thank you to anyone who can help.

Lukas Knuth
  • 25,449
  • 15
  • 83
  • 111
Chris S
  • 422
  • 1
  • 4
  • 13
  • 4
    If you have no idea how to start: **Read a Book**. Learning something completely new from the docs is hard. Read a book to get a long-term example and dive into it more easily. – Lukas Knuth Feb 28 '13 at 13:15
  • @Lukas Knuth I am reading up on it, i'm watchin youtube videos, i'm reading through anything on this site that might help. I was only hoping that someone might be able to point me in the right direction, as opposed to me trudging through mostly unhelpful tutorials, in hopes of finding something semi-useful. Thanks all the same :) – Chris S Feb 28 '13 at 13:53

5 Answers5

1

Well, if you don't know anything about Android, how about doing some basic HelloWorld tutorials?

Anyway, you'll have to make some class that holds the info about your users (Location, Phone etc).

The dropdown thingy is called a spinner in Android, learn about how to put it in your layout, how to populate it, how to react to an item being selected from it.

Then think about how you want to present the info on the screen, learn about XML layout, TextViews etc.

We won't code this for you and it won't code itself, just start somewhere.

fweigl
  • 21,278
  • 20
  • 114
  • 205
  • I'm not asking anyone to code it for me, sorry if that impression came across, i'm looking for someone to go "oh, it'd be best if you used an xml front end and a database in the background and cross reference them" or something like that. Well i've been doing android/java for awhile, i've done a lot of basic stuff with it, but this is pretty far away from what i've done already. thanks for the info about the spinner, didn't know it was called that. I'll look into it. – Chris S Feb 28 '13 at 13:34
1

To start developing for Android, you could try the Getting Started tutorial on the android.com site: http://developer.android.com/training/index.html

GvS
  • 52,015
  • 16
  • 101
  • 139
1

I think you have the first step done. To me, if you can visualize and draw out what you want, the next step is to just dive head first into the code. You will learn, just don't be afraid to do some internet searches first.

First of all, I always recommend that new Android developers look at the Android lifecycle to understand what happens where. For your application, you should understand what an Activity is, and what happens in onCreate(). Do some reading and try to grasp what an Android Activity is.

Next, you should look at working with Android Layouts. This will help you put something on your screen. By default, a basic layout.xml file is generated when you create a new Android application in Eclipse. Use this as a basic framework for dropping Input Controls on to the screen. The specific "drop-down" functionality you are looking for can be found in the Spinner control.

Once you have a Spinner on your screen, you can then fill it by creating an Array of values that you would assign to an ArrayAdapter. This ArrayAdapter then gets associated directly to the Spinner to fill it.

Use the Android Developers site, it is very useful. They have tutorials and sample code in the SDK as well.

This answer should have plenty of terms, links, and direction for you to get started.

Update:

I would like to expand on my answer to be more specific, but I think I need a little more information. For example, are you pulling these names from anywhere specific (ie. the device itself?). Regardless, the names have to be put in the form of some type of array, either a String Array or an ArrayList. This is only because that is how ArrayAdapters work and ArrayAdapters are what populate Spinner objects. So I guess what I am trying to say is that regardless of how you get your names, you are going to have to organize them in some type of array to put them into the Spinner (if you want to keep it simple of course).

Now, once you get the names put into your array and you can click the Spinner to show them all, you now want to trigger an event that pulls the data you would like to show beneath it. I would recommend doing this in 1 of 2 ways. You can select a name from your Spinner and then hit a button to initiate a search for the other information you would like to show. This would be a better solution if you are pulling the data on the name from a network resource. If you are pulling the data associated to the name selected from the actual device (either a SQLite DB you configured or an Android system DB), I would just use an onSelectionChanged listener on your Spinner. You can do that by using something similar to this answer:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Spinner spinner = (Spinner)findViewById(R.id.mySpinner);

    // create your arrayadapter of names and then set it to your spinner        

    // then add a lister to look for a change
    spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
            // update your view with the information for the selected user
        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {
            // do something
        }    
    });
}

Once you can register a change in the spinner, you can then just initiate a query to determine what information to display. If you create a custom DB with all of the information associated to names, you have to create your own DB handler. If you pull the information from a network resource, make sure that you put your networking operations in a background thread, or AsyncTask. If you are pulling the information from your Android device (contact records or something), just use Android's build in functions, libraries, and API's. I would try to keep everything localized instead of having to depend on a network connection.

Once you have all of the information, you can dynamically create layouts and add them to your current view or you can just have a single layout that you change occasionally and to show and hide. Both of these solutions are completely reasonable, and I don't believe one is necessarily better then the other. I used to be a fan of just making objects invisible and showing them when I needed them, but I am getting into programmatically creating layouts on the fly when I need them. This seems to be a little more difficult for new Android developers though, so don't feel bad if you have sketchy if/else statements that just show and hide XML layouts.

Anyway, hopefully all of that helps!! Welcome to Android!

Community
  • 1
  • 1
burmat
  • 2,548
  • 1
  • 23
  • 28
  • 1
    I found [this](http://www.herongyang.com/Android/Activity-onCreate-and-Callback-Methods.html) website to be useful in understanding the Android lifecycle. – TronicZomB Feb 28 '13 at 13:29
  • Good answer, thank you. I've looked at the life cycle, i had to understand it while working with splash screens. So basically store all the information in an array (e.g. array user1, loc1 etc) and call up as needed? Would that not give me an awful lot of arrays to work with? – Chris S Feb 28 '13 at 13:48
  • @ChrisS I appended my answer. Hopefully that helps you get started! – burmat Feb 28 '13 at 14:09
0

What you are looking for is an Android simple CRUD application tutorial, google it. (Well, assuming you've got a basic android development knowledge...)

sample of result : http://www.theserverside.com/discussions/thread.tss?thread_id=62177

Guian
  • 4,563
  • 4
  • 34
  • 54
0

These are some useful tutorials that can be found via Google.

http://commonsware.com/Android/

TronicZomB
  • 8,667
  • 7
  • 35
  • 50