Information for swapping tiles in a gridview - android

i'm making an n-puzzle and already have a gridview with one blank image in the bottom-corner in the right. My goal is now to shuffle the images in the gridview and make a game of fifteen. As beginning programmer in android i have little knowledge of the platform and would apreciate tips and tricks or hints of how i must handle this problem.
I already know that the .setTag() command will be very handy for this problem, but can't seem to find informationblogs or sources on how to use it properly and how to handle this problem.
with kind regards,
Kees Til

Related

Making an android app with 365 imageviews

I need help understanding how I would approach making an Android application that allows the user to scroll through 365 different bitmaps. I'm worried that I will go outside of the memory limits that android allows. I've tried googling, but haven't been able to understand how to approach the problem. Could someone write a very brief hint at where i can start researching this?
It depens on the source of those. I think you would like to use "lazy load ListView".
Checkout this
how about using any class that extends from AdapterView (like listView, gridView,...) ?
the idea is that since the user doesn't really see all of the views at the same time , you can re-use views that are being disappeared when scrolling , and show them as new ones .
watch the video of google called "the world of listView" .
anyway , if you don't wish to use this solution , consider being very "cheap" on the memory , as you are correct - android will kill your app if you use too much RAM .
you can read about handling bitmaps here .

Android user interface elements usage

I did search the internet to find an answer to my questions but there are no websites that did help me, so I hope someone can! Thank you in advance and have a nice day :-)
So these days I've been busy to get more into the Android Design guidelines and to learn more about it and how to implement it in my future applications. This is the main website I use to see what the guidelines are: http://developer.android.com/design/index.html. Great website but there are a few small things I just can't find in the dev guide or somewhere else. I just don't know how to implement some (simple) UI elements.
Can someone provide me code snippets of the following questions? (I want to know how to do it as simple as possible, how Google ment it!) It can help other (starting) developers too!
My main question is, are there special elements to achieve these things? As they are the key element in Android 4.0 it should have this things as some standard right?
1) Android 4.0 is using titles with dividers a lot in there new theme and it's looking great. But I can't find how to do implement this element simple like it should. What I want to know is how to make this blue title text with the grey looking divider underneath it look at this picture:
2) How to make section dividers in general? Like this image:
3) How to make a list with section dividers and give a list-item a 2-line explanation under it's name like this:
I did search the internet to find an answer to my questions but there are no websites that did help me, so I hope someone can! Thank you in advance and have a nice day :-)
In most cases how you are going to have to do it is create a custom layout. I tried recreating the look of the people application this way. for the most part the look you are going for is similar to the PreferenceActivityview. That gives you the look of the last image and probably how it was done in the People application with some extra programming. I just found it easier to create my own layout though instead of trying to mess around with that.
To my knowledge there is nothing in the api to create what you are looking to do easily and custom layout are going to be the way to go.
the custom dialog layout like you show in the beginning is very simple to do so if you dont know how to do manipulate layouts I would start there. look up the android color swatches to get the color of that blue
Edit
another thing you could do is look through the People source code and see how they did it but it will probably be more of a pain than what its worth when you can just do a layout

Android Gallery View Semi Circle Theme

Hi friends i am planned to work on user interface part, i wanted to make my own user interface for my gallery application. for example gallery view should be in semi circular view. can any one suggest me on this
Thanks in advance
Do you want something like this!!
you can find it in this link
sorry but the link is in french language but you can find sources in the bottom of the page Mirror links
You should start by learning more about the Gallery in general. This link would make a good start.
Understand that code, go through the tutorials and begin experimenting on making incremental changes and seeing if they work.
Using this knowledge and prototype code start thinking about how you might go about creating your custom semi-circle gallery. Experiment and try some different things.
When/if you run into any issues or specific problems, post your question on a new thread and I'm sure you will find people willing to help you out.

Scrollview with paging in android

is there a simple/native way to implement paging/pagination on scrollviews?
By simple, I mean with a short piece of code mainly using classes from Android SDK, like, when programming on iPhone, writing "pagingEnabled = YES".
When I was looking for the topic on the Internet, I saw people putting pieces of code about that matter, but these pieces of code were very large, and I can't help myself to believe Google did put a simple way to do it in their SDK. I also think that the code to implement it could be much easier than what I saw when looking for it. I'm currently working on it, but in the meantime, if anyone know a easier way to do it, I would be delighted to know about it.
Thanks for reading!
I think that there is not a fast solution to do this.
But what you can do is to take the gallery component and override the layout. The gallery component has paging :)
Another solution could be:
Horizontal Pager - https://github.com/ysamlan/horizontalpager
Real View Switcher http://marcreichelt.blogspot.com/2010/09/android-use-realviewswitcher-to-switch.html
Hope this helps...

GridView vs. Other layouts for memory game | Android

I'm trying to create a memory game. I've looked at the Android tutorials for GridView and, while it works, it is somewhat difficult to understand and customize. I would like to ask for advice and opinions on what layouts I should use for the memory game I'm working on. It'll be a simple "grid" of pictures and people will be trying to find the matching pairs.
Please provide what you think would be a good layout to use and the advantages/disadvantages of that layout. Layouts such as Gridview, LinearLayout, TableLayout, etc.
Are there any layouts that are simple and easy to customize for my memory game? I'm asking as someone who is new to programming. I have watched an introductory programming video lecture series from Stanford using Java, so I understand the basics of Java but I am not advanced.
More information, just in case you want to know:
I initially tried to create the GridView in java and not XML. But for some reason, the GridView wouldn't display on the emulator. It was just a blank screen. I believe it was because I did not have the layout set to MATCH_PARENT. But I don't know how to do that from java. I tried googling it, but I couldn't find an answer. I eventually settled on doing it through XML. If anyone knows how to do it through java, that would be very much appreciated.
I also had difficulty understanding the ImageAdapter class in the GridView tutorial: (http://developer.android.com/resources/tutorials/views/hello-gridview.html). Specifically, I do not understand how or when the getView() function is called. It isn't explained in the tutorial.
I was able to get it to work but because I don't understand it very well, I am not sure how much I will be able to customize it for my memory game.
I'm sorry for the long post. My question is mainly about which layout I should use for my memory game. If you can answer the question about creating a GridView in java that displays on the emulator, that would be great.
Thank you for your time.
I wrote a fairly straight-forward tutorial for extending BaseAdapter - which is exactly what you'll want to do.
Define your layout in XML. Use a GridView. Then just write a custom adapter to control what gets displayed in the grid.
http://androidcookbook.com/Recipe.seam?recipeId=588
It's written with a ListView in mind but the same methods will be implemented for a GridView. If that is too advanced you'll need to start with a smaller app and build your understanding from a lower level.

Categories

Resources