I'm trying to make a kind of quiz-app relative to the music field where I keep on showing random images and the user takes the answers. For each answer I check in a database whether it is right or not. You can see some examples of what I mean here and here. The problem is that I should put in the Android Project a great number of images, which I suppose is not good. So I'm wondering if there is another way for doing that, maybe using sample-images for each element (a single note, a single sharp, the treble clef etc.) and fixing them toghether in some way in order to "build" the final image.. I really don't know. And also, is there a way to verify the answers without internet connection? Thanks in advance.
You can make a CustomView or views http://developer.android.com/training/custom-views/index.html and have it draw differently, depending on exactly what you're trying to convey. You could use a background as well as images, and draw the lines.
Adding custom View and ImageView to a single Layout explains how to include images in a CustomView .
Related
I want to create a crossword puzzle using android studio. the problem that I run into is I can't figure out a good way to draw the crossword puzzle the crossword
upon selecting a word from that shape. the user will access an interface that is designed specifically for that word. where to enter the answer
The problem I have is how to actually create that crossword shape, especially since I need it to be created dynamically afterwards based on the supplied data.
After 15 days of research all I can find are those possibilities:
Using Table layout with each cell representing a character. But this approach is not appropriate and not optimate and create many problems.
Using GridView with the unused cells set to be invisible. this is better but I think there is a better way than creating Grids only to set most of it to invisible.*
**I am sure there is a better way, but can't figure it out.
I know I have to give a code sample for what I have but I can't even do that till I know what approach I need to create this. If there is any suggestion to make my question clear that will be welcomed as well.
Neither. This calls for custom view for the word grid. While you can probably get it to work without one, it's going to look very amateurish, and you're going to be very hacky. Instead, you'll want a totally custom view doing its own keyboard input handling. Unless this is like a school project where looks and UX don't matter and you just need it done.
this is my ImageButton. my confusion is that i do not know how to determine whether the user clicked on the Login half, or the Sign up half, so i can take them to the respective Activity. i would be incredibly grateful if somebody can 1) name a resource i can use to learn on my own, or 2) explain the process of finding view locations and any possible algorithms used to determine if a click was in bounds of a specific portion of a View or not.
You should divide your button into 2 different ones, and process clicks separately.
Have 2 image buttons and try to achieve the same look and feel you want.
In your case, even though this kind of thing is doable. It is expensive and complicated and unnecessary. And you will have problems with styling of the buttons (eg: focus)
Edit:
Yes I understand, But I suggest you not to over complicate things. Because, your device has limited resources (eg: battery),
But you can still get the experience on how to create a circle like button with two sides on it, using 2 buttons which is still exciting :D.
I want to create a android view that takes in a specific number and fills up a circle depending on that number. Example of view in the following link:
This view is to view how much data has been used by the user. My question would be what would be the best way to do this? How would I make the circle fill its self depending on the data used up everytime the person checks his data usage. Any tips are welcome.
PS: sorry for my bad English.
You could use a circular progressbar to do it and change the progress on change of the data count. You could yuse this library to do it https://github.com/lzyzsd/CircleProgress It has many different designs, so you could choose from them the one, which is best for you :)
Other possibilities you could see in the answers of this SO question How to create circular ProgressBar in android?
Ive looked into the ViewFlipper, but defining 40 different views in one XML doc just doesn't seem like a bright idea. I know there has to be a better way, I just don't know how. I have spent some time trying to find a answer with no good answer so far.
I have used the Gallery widget (admittedly quite heavily modified) to display 200 fullscreen images in an image viewer for a client.
Alternatively you could use a ViewAimator with either 2 (in this case ViewFlipper) or 3 views (3 if you want to preload both the next and previous images). If you go for this approach then Laurence beat me to suggesting this idea ;) However I'd add that you would want to extend the ViewAnimator/ViewFlipper class to allow it to accept some type of Adapter.
A simple approach would be to simply contain two ImageViews within the ViewFlipper. Then when you request the next or previous view, set the new image resource for the next view and flip.
If you implement a lazy loader using AsyncTask or a Handler this will stop your UI thread from blocking.
Hope this helps!
You could use a ViewPager (included in the Android compatibility library if you need to support pre-Honeycomb devices).
I want to create an activity, which shows a question with 4 answers, and at the bottom of the screen i want to place a timer.
I have already found timer example, and i created a question with the answers. the problem that they are 2 different projects and activities, and i am looking for the best way to implement it. i think i can't show 2 activities on one screen, but i can show 2 views or shell i use the ViewGroup, or maybe to copy-paste one of the activities code to another ( its the easiest way but probably the most ugliest way to implement it).
please tell me what is the best way, that i will study and not to waste time to study all the ways and only then to choose one of them.
welcome to StackOverflow.
You are correct in that you cannot display two activities at once. You must instead look into how layouts work in Android by reading some tutorials on the Android developer guide.
For your layout, I would recommend using a LinearLayout with four TextView objects inside it containing the questions (and perhaps your EditText objects below them) as well as your timer. Make sure they are all inside a ScrollView so the software keyboard doesn't force it all to be squeezed up. This is how I would approach it, but I encourage you to read about how layouts work and use the XML resources.
The Notepad tutorial is an excellent way to get started with views and text entry, as well as using SQLite databases.