Developing a clothing game for Android
| What the hell am I doing? Developing a clothing game for Android...
Last time I was really bored, i tried to make a simple clothing game for android. Here is the tutorial: |
![]() |
On the first google image page of results for android there is a cute robot image:

In photoshop you can use the slice tool to cutting this robot into slices:

After that save the image using the 'Save for Web...' option. Here you should set every silice's settings like this:

After that create a new android project in eclipse, then copy thoose images into drawable folder.
Modify the main.xml like this:
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout android:id="@+id/LinearLayout01"
; xmlns:android="http://schemas.android.c om/apk/res/android" - android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="wrap_content">
- <LinearLayout android:id="@+id/LinearLayout02"
; android:layout_width="wrap_content" android:layout_height="wrap_content"><ImageView - android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/horn" android:id="@
- +id/horn"></ImageView>
- </LinearLayout>
- <LinearLayout android:id="@+id/LinearLayout03"
; android:layout_width="wrap_content" android:layout_height="wrap_content"><ImageView - android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/head" android:id="@
- +id/head"></ImageView>
- </LinearLayout>
- <LinearLayout android:id="@+id/LinearLayout04"
; android:layout_width="wrap_content" android:layout_height="wrap_content" - android:orientation="horizontal"><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:src="@drawable/leftarm" android:id="@+id/leftarm"></ImageView>
- <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/body" android:id="@
- +id/body"></ImageView>
- <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rightarm"
- android:id="@+id/rightarm"></ImageView>
- </LinearLayout>
- <LinearLayout android:id="@+id/LinearLayout05"
; android:layout_width="wrap_content" android:layout_height="wrap_content" - android:orientation="horizontal"><ImageView android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:src="@drawable/leftnothing&qu
ot; android:id="@+id/leftnothing"></ImageView> - <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/legs" android:id="@
- +id/legs"></ImageView>
- <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/rightnothing&q
uot; - android:id="@+id/rightnothing"></ImageView>
- </LinearLayout>
- </LinearLayout>
Then check the layout, your robot should be ready to clothing :)

Use photoshop or mspaint or anything else to edit the slices, than save them. Use the original file names plus a number, for example
head2, head3, horn2, horn3...
Use your fantasy :)

After that create an itemselect.xml file, than modify like this:
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout android:id="@+id/LinearLayout01"
; xmlns:android="http://schemas.android.c om/apk/res/android" - android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical">
- <ImageView android:id="@+id/first" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
- <ImageView android:id="@+id/second" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
- <ImageView android:id="@+id/third" android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
- </LinearLayout>
This is the easiest way to select the new body part, using an existing imageview.
After that create a new class, called DataStorage.java. This class helps you to save and load the parts of your droid.
Use that methods:
- private SharedPreferences mPrefs;
- mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
- }
- public void setHead(int id){
- SharedPreferences.Editor edit=mPrefs.edit();
- edit.putInt("head", id);
- edit.commit();
- }
- public int getHead(){
- return mPrefs.getInt("head",0);
- }
- public void setHorn(int id){
- SharedPreferences.Editor edit=mPrefs.edit();
- edit.putInt("horn", id);
- Log.d("savehorn:",""+id);
- edit.commit();
- }
- public int getHorn(){
- return mPrefs.getInt("horn",0);
- }
- public void setLeftHand(int id){
- SharedPreferences.Editor edit=mPrefs.edit();
- edit.putInt("lefthand", id);
- edit.commit();
- }
- public int getLeftHand(){
- return mPrefs.getInt("lefthand",0);
- }
- public void setRightHand(int id){
- SharedPreferences.Editor edit=mPrefs.edit();
- edit.putInt("righthand", id);
- edit.commit();
- }
- public int getRightHand(){
- return mPrefs.getInt("righthand",0);
- }
- public void setLegs(int id){
- SharedPreferences.Editor edit=mPrefs.edit();
- edit.putInt("legs", id);
- edit.commit();
- }
- public int getLegs(){
- return mPrefs.getInt("legs",0);
- }
- public void setBody(int id){
- SharedPreferences.Editor edit=mPrefs.edit();
- edit.putInt("body", id);
- edit.commit();
- }
- public int getBody(){
- return mPrefs.getInt("body",0);
- }
I wrote a ClickListener method. It helps you to save your clicked body part, than retuns to main screen.
- public void ClickListener(ArrayList<ImageView> im, final int i, final int bodypart, final DataStorage ds, final Context
- context ){
- im.get(i).setOnClickListener(new OnClickListener(){
- @Override
- //ds.setHorn((ImageView)v.);
- switch(bodypart){
- case 1:
- ds.setHorn(i);
- break;
- case 2:
- ds.setHead(i);
- break;
- case 3:
- ds.setBody(i);
- break;
- case 4:
- ds.setLeftHand(i);
- break;
- case 5:
- ds.setRightHand(i);
- break;
- case 6:
- ds.setLegs(i);
- break;
- }
- Intent i = new Intent(context.getApplicationContext(), Game.class);
- context.startActivity(i);
- }} );
- }
In your main class declerate the imageviews and a DataStorage object:
- ImageView horn, head, leftarm, body, rightarm, leftarm, legs;
- DataStorage ds;
- [...]
- horn = (ImageView)findViewById(R.id.horn);
- head = (ImageView)findViewById(R.id.head);
- leftarm = (ImageView)findViewById(R.id.leftarm);
- rightarm = (ImageView)findViewById(R.id.rightarm);
- legs=(ImageView)findViewById(R.id.legs);
Then create array lists for body parts. For example the horn list:
- ArrayList<Integer> hornList=new ArrayList<Integer>();
- hornList.add(R.drawable.horn1);
- hornList.add(R.drawable.horn2);
- hornList.add(R.drawable.horn3);
- horn.setImageResource(hornList.get(ds.getHorns()));
Then you need to create an item selector class. It uses the itemselect.xml.
- setContentView(R.layout.itemselect);
You should declerate the ArrayLists again in this class, and a DataStorage object.
In this case I used a simple switch-case statement to save the clicked item. Use the DataStore object's ClickListener method.
- switch (bodypart){
- case 1: //horn
- for (j=0;j<hornlist.size();j++){
- im.get(j).setImageResource(hornlist.get(j));
- if (j==0){
- ds.ClickListener(im, 0, bodypart, ds,context);
- }
- else if (j==1){
- ds.ClickListener(im, 1, bodypart, ds,context);
- }
- else if (j==2){
- ds.ClickListener(im, 2, bodypart, ds,context);
- }
- else if (j==3){
- ds.ClickListener(im, 3, bodypart, ds,context);
- }
- }
- Toast.makeText(context, "Click the back button to show your robot", 3).show();
- break;
- case 2:
- for (int j=0;j<headlist.size();j++){
- im.get(j).setImageResource(headlist.get(j));
- if (j==0){
- ds.ClickListener(im, 0, bodypart, ds,context);
- }
- else if (j==1){
- ds.ClickListener(im, 1, bodypart, ds,context);
- }
- else if (j==2){
- ds.ClickListener(im, 2, bodypart, ds,context);
- }
- else if (j==3){
- ds.ClickListener(im, 3, bodypart, ds,context);
- }
- }
- Toast.makeText(context, "Click the back button to show your robot", 3).show();
- break;
- case 3:
- for (int j=0;j<bodylist.size();j++){
- im.get(j).setImageResource(bodylist.get(j));
- if (j==0){
- ds.ClickListener(im, 0, bodypart, ds,context);
- }
- else if (j==1){
- ds.ClickListener(im, 1, bodypart, ds,context);
- }
- else if (j==2){
- ds.ClickListener(im, 2, bodypart, ds,context);
- }
- else if (j==3){
- ds.ClickListener(im, 3, bodypart, ds,context);
- }
- }
- Toast.makeText(context, "Click the back button to show your robot", 3).show();
- break;
- case 4:
- for (int j=0;j<leftarmlist.size();j++){
- im.get(j).setImageResource(leftarmlist.get(j));
- if (j==0){
- ds.ClickListener(im, 0, bodypart, ds,context);
- }
- else if (j==1){
- ds.ClickListener(im, 1, bodypart, ds,context);
- }
- else if (j==2){
- ds.ClickListener(im, 2, bodypart, ds,context);
- }
- else if (j==3){
- ds.ClickListener(im, 3, bodypart, ds,context);
- }
- }
- Toast.makeText(context, "Click the back button to show your robot", 3).show();
- break;
- case 5:
- for (int j=0;j<rightarmlist.size();j++){
- im.get(j).setImageResource(rightarmlist.get(j));
- if (j==0){
- ds.ClickListener(im, 0, bodypart, ds,context);
- }
- else if (j==1){
- ds.ClickListener(im, 1, bodypart, ds,context);
- }
- else if (j==2){
- ds.ClickListener(im, 2, bodypart, ds,context);
- }
- else if (j==3){
- ds.ClickListener(im, 3, bodypart, ds,context);
- }
- }
- Toast.makeText(context, "Click the back button to show your robot", 3).show();
- break;
- case 6:
- for (int j=0;j<legslist.size();j++){
- im.get(j).setImageResource(legslist.get(j));
- if (j==0){
- ds.ClickListener(im, 0, bodypart, ds,context);
- }
- else if (j==1){
- ds.ClickListener(im, 1, bodypart, ds,context);
- }
- else if (j==2){
- ds.ClickListener(im, 2, bodypart, ds,context);
- }
- else if (j==3){
- ds.ClickListener(im, 3, bodypart, ds,context);
- }
- }
- Toast.makeText(context, "Click the back button to show your robot", 3).show();
- break;
- }
Thats it.. :)
Feel free to download the source code HERE. (Sorry for hungarian variable names :))
New tutorials from Helloandroid
Recent Apps
Android on Twitter
-
@800whitet (justin mayfield)I've just received an achievement: Terror of untidiness https://t.co/oO4KPwsg #Android #Androidgames
5 min 37 sec ago -
@Gleydsonxdd (Gleydson )I have just connected Textile Mill in My RailWay. You can get it for FREE on Android! http://t.co/MhK6XUog #android #androidgames
5 min 43 sec ago -
@hong1515 (Harry Seunghwan Hong)HP TouchPad Android kernel now in the hands of CyanogenMod team http://t.co/6FV1dxYD #android
5 min 46 sec ago -
@eddieiris67 (ed oneill)I've just received an achievement: Total Upgrade http://t.co/e7WfiRnn #Android #Androidgames
5 min 54 sec ago -
@kmj22120 (김민정)I've just received an achievement: Income Collector https://t.co/0ejBO0sY #Android #Androidgames
5 min 58 sec ago
Poll
Useful resources
Android Development Projects
- Android App wanted immediately by JoePublic
- LIST DATA PROJ by nhammoud
- Nonpublic project #1433932 by subpariq
- Alarm Android Application Design by globalheed
- Simple Album App for Android by ayfonfan
- iOS and Android photo manipulation 'Morph App' by whatwedomedia
- Onsite Software Engineers in Germany by sudhirshree
- Augmented reality by merder99
- Nonpublic project #1433560 by vobla73
- Mobile app coder needed for quick, simple app by Ergometrix





Comments
دردشة سورية دردشة
دردشة سورية
دردشة لبنانية
دردشة عراقية
شات سوري
شات لبناني
دردشة سوريا
دردشة لبنان
شات سوريا
شات لبنان
دردشة السويدي
منتديات السويدي
اغاني عراقية
صور فنانين
الرياضة العراقية
شعراء العراق
نغمات عراقية
اغاني عربية
اغاني كردية
دردشة عراقية
دردشة بنات العراق
دردشة صبايا بغداد
دردشة البصره
دردشة بغداد
دردشة بغدادية
دردشة صبايا بغداد
دردشة شباب العراق
دردشة بنات العراق
دردشة الكرادة
دردشة دمشق
دردشة بيروت
دردشة حلب
دردشة حلب
دردشة عراقية
دردشة العراق
شات عراقي
جات عراقي
دردشه عراقيه
دردشة صبايا لبنان
دردشة بنات لبنان
شات صوتي | دردشة صوتية | كلام
شات صوتي
| دردشة صوتية
|
كلام
| شات كلام
|
دردشة كلام
| دردشة صوتية
|
شات صوتي
| شات
|
Chat Voice
| ahj w,jd
شات صوتي
| دردشة صوتية
|
شات صوتي
| دردشة صوتية
|
دردشه
| دردشة
|
صوتي
| صوتية
|
شات صوتي
| دردشة صوتية
|
شات صوتي
| دردشة صوتية
|
الكلام
| دردشه صوتيه
|
]v]am w,jdm
| ]v]ai w,jdi
شات صوتي
شات صوتي
شات صوتي
I think we need to bring more
I think we need to bring more ideas for this purpose. Involvement of young people can be handy in this regard. I am happy to find a good post here. Bankruptcy attorneys
Cute Robot
Cute robot. Thanks for the great tutorial on the app. And very kind to offer the link to the free download. Thanks! Coffee Lover
very useful tutorial
very useful tutorial
galaxystab
iphone 5 apps
عربى داونلود
Very nice tutorial,love
Very nice tutorial,love it!
signalsforex
Property Investment
Thanks for the information for the app. I always wondered what the code looked like to build these apps.Baju Muslim It's been an interest of mine to start doing some research and build some of these myself. Thanks for the article and letting me share
maid of honour speeches
This post is beneficial and interesting. A lot of people will certainly assert that everything in your website is great. In the event you continue writing useful articles on your web site, often there is a greater possibility that a lot of website visitors will visit your web site. maid of honour speeches
ironman gravity 4000 inversion table
That is a great point to bring up. I offer the thoughts above as general inspiration but clearly there are questions like the one you bring up where the most important thing will be working in honest good faith. I don?t know if best practices have emerged around things like that ironman gravity 4000 inversion table
teeter hang ups ep 550 inversion table
the datagrid problem came up. My question is: I have to connect to a third party system which I can query with a specific language. The result is given back as a datatable with all the rows and columns. Can I connect/use this datatable as a datasource for the grid teeter hang ups ep 550 inversion table
best inversion table
I understood a third of the jokes. The Jerk, The Three Amigos and Parenthood are movies that I’ll stop and watch again, whenever I stumble upon them while channel surfing. His sublime performance in Baby Mama makes me thankful that he’s managed to keep up his acting along with his other passions. His diverse talents and interests have inspired me to consider a future where acting best inversion table
It's been an interest of mine
It's been an interest of mine to start doing some research and build some of these myself. Thanks for the article and letting me share.
5 door hatchback car
floral duvet covers
the contents you have mentioned.I wanted to thank you for this great article.I enjoyed every little bit part of it and I will be waiting for the new updates also so do post them floral duvet covers
This is a fantastic website
This is a fantastic website and I can not recommend you guys enough. Full of useful resource and great layout very easy on the eyes. Please do keep up this great work. Medical Assistant
Robert Pattison weight
I was passing around and come across your site. It is wonderful. I mean as a content and design. I added you to my list and decided to spent the rest of the weekend Robert Pattison weight
There is an article that
There is an article that gives great insight to foundational elements when it comes to being able to successfully make money on the internet. Shizuko Leuhring
A friend of mine advised this
A friend of mine advised this site. And yes. it has some useful pieces of information and I enjoyed reading it. Therefore i would love to drop you a quick note to express my thanks. Take care
Riverside criminal defense attorney
no
What the hell am I doing? Developing a clothing game for Android...
Last time I was really bored, i tried to make a simple clothing game for android. cv
good idea
After that save the image using the 'Save for Web...' option. Here you should set every silice's settings
cl cm cn co cp cq cr cs ct cu
Great
I like this script:
<?xml version="1.0" encoding="utf-8"?>
a visit b visit c visit d visit e visit f visit g visit h visit i visit j visit k visit l visit m visit n visit o visit p visit q visit r visit s visit t visit u visit v visit w visit x visit y visit z visit aa visit ab visit ac visit ad visit ae visit af visit ag visit ah visit ai visit aj visit ak visit al visit am visit an visit ao visit ap visit aq visit ar visit as visit at visit au visit av visit aw visit ax visit ay visit az visit ba visit bb visit bc visit bd visit be visit bf visit bg visit bh visit bi visit bk visit bl visit bm visit bn visit bo visit bp visit bq visit br visit bs visit bt visit bu visit bv visit bw visit bx visit by visit bz visit ca visit cb visit cc visit cd visit ce visit cf visit cg visit ch ci cj ck cl
We can give them a good
We can give them a good education that they can use in their life to get a better chance in this life. Im sure with a good education all of us will see the changing that all that kids can have. Nick Lighthill
Developing a clothing game for Android
Mais on peut rencontrer plusieurs modèles de housse pour ces valeureux smartphones. les écrins souples qui ne se vendent pas très cher et abritent le smartphone au strict minimum, les coques solides en plastique parfaitement efficaces contre les entailles et les luxueux fourreaux en cuir qui abritent totalement les iPhones avec une flexibilité hors pair notamment due au cuir qui le constitue. etui blackberry torch housse nokia n8 etui xperia x10 etui htc desire etui htc hero housse ipadCes housses en cuir fabriqués pour appareil mobile sont aussi disponibles avec un clapet rabattant qui permet de protéger totalement l’écran des heurts et griffures. De plus, leur maniabilité est souvent exceptionnelle. Mais il y a un contrecoup car ces étuis de luxe coûtent très cher mais comme le veut le dicton : la qualité, ça se paie. Tout d’abord, le fourreau doit parfaitement s’adapter à votre poche. housse iphone 4 housse ipad pochette iphone housse téléphone etui iphone housse mobile pochette iphone housse iphone 3gs etui samsung galaxy etui samsung wave Assurez-vous à côté de ça que l’écrin en plastique ne soit pas trop encombrant et ne vous gêne pas quand vous devez le prendre avec vous et lors de l’utilisation de votre téléphone portable. Ensuite, faites attention à ce que l’étui est composé une protection pour l’écran de votre mobile (c’est hautement préférable). Les étuis en cuir avec un clapet rabattant sont les plus adaptés pour cela. magazine chiot
Thanks for the information
Thanks for the information for the app. I always wondered what the code looked like to build these apps.
GSM Kampanya | Bilişim Teknoloji | Cep Telefonu | Turkcell Kampanyaları | Avea Kampanyaları | Vodafone Kampanyaları
Great article
Thanks for the information for the app. I always wondered what the code looked like to build these apps. It's been an interest of mine to start doing some research and build some of these myself. Thanks for the article and letting me share.
a visit b visit c visit d visit e visit f visit g visit h visit i visit j visit k visit l visit m visit n visit o visit p visit q visit r visit s visit t visit u visit v visit w visit x visit y visit z visit aa visit ab visit ac visit ad visit ae visit af visit ag visit ah visit ai visit aj visit ak visit al visit am visit an visit ao visit ap visit aq visit ar visit as visit at visit au visit av visit aw visit ax visit ay visit az visit ba visit bb visit bc visit bd visit be visit bf visit bg visit bh visit bi visit bk visit bl visit bm visit bn visit bo visit bp visit bq visit br visit bs visit bt visit bu visit bv visit bw visit bx visit by visit
pokeren
I am very much pleased with the contents you have mentioned.I wanted to thank you for this great article.I enjoyed every little bit part of it and I will be waiting for the new updates also so do post them soon.
تسريحات منتديات مكياج ازياء
تسريحات منتديات مكياج ازياء رسائل وسائط مسجات توبيكات وظيفة وظائف ديكور بلايز رجيم رشاقة حلويات معجنات نكت ديكورات لاين سبورت رمزيات صور رمزيه توبيكات ملونه صور العاب
Well, I am so excited that I
Well, I am so excited that I have found this your post because I have been searching for some information about it almost three hours. You helped me a lot indeed and reading this your article I have found many new and useful information about this subject. the diet solution program
Very good article, very
Very good article, very usefull!!
Excellent read, I just passed
Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: Netbook Reviews
We can give them a good
We can give them a good education that they can use in their life to get a better chance in this life. Im sure with a good education all of us will see the changing that all that kids can have. DVD Ripper For Mac
There is an article that
There is an article that gives great insight to foundational elements when it comes to being able to successfully make money on the internet. beertender b90
Companies these days are
Companies these days are using ergonomic furniture to ensure that there are no injuries from work related hazards. Use an ergonomic chair and feel better comfort in your back and shoulder. rabattkod
Clothing?
Well, create clothing is definitely something new and can have fun while doing it, don't you think so? search engine optimization services social media Not necessary something bore, people like weird thing too : )
that's great idea
^_^. it's really funny. you can make it can more
This looks interesting, but
This looks interesting, but I'd like to see the app do more than this. I'm not really interested in styling up an alien, now if you made it use cat jewelry, that might be another story.
Clothing app!
Clothing? Haha, intresting app idea... Takes me too much time to do one of these apps I have to make sure it's something I'll really use a lot :P
vitamin b12 benefits
hehe the things that boredom can drive us to
Nice App, is it finished yet? Can you set the dressed android as wallpaper? That would be pretty cool.
seo services whitehat seo
Great Article
Thanks for the information for the app. I always wondered what the code looked like to build these apps. It's been an interest of mine to start doing some research and build some of these myself. Thanks for the article and letting me share. Low-E