Well, if you were ever curious what 132 hours of art, coding, and audio look like in Android, check out v1.1 of Slot Madness. It's FREE, fun, and features a leader board of the top 50 grossing players. All the front end and back end was set up by me and everything I learned was from grinding out tutorials and years of watching mybringback and thenewboston. Please check it out and rate/give any suggestions you want so I can make it the best out there, or at least try. Thanks, Kenneth.
https://play.google.com/store/apps/details?id=com.a54.studio.slotmadness
Showing posts with label a54studio. Show all posts
Showing posts with label a54studio. Show all posts
Thursday, December 5, 2013
Monday, June 10, 2013
Dialog/orientation change memory leaks...
Well, today I kept battling a memory leak in my opening screen for Perspective when rotating the phone. A quick search yielded plenty of references to orientation changes when rotating. There were quite a few work arounds, but I found a simple one that really made it simple for me so I figured I'd share.
To fix the problem in my PopDialog class that extends a Dialog, I added a
static PopDialog pd=null;
Then I added this just after the onCreate
pd=PopDialog.this;
MainActivity.opened=true;
and finally I added this method
public void dismissing(){
if(pd.isShowing()){pd.dismiss();}
}
OK, that's the hard part. Now in my main activity, I referenced it like this
PopDialog popdialog;
private static boolean opened=false;
after onCreate in that activity
popdialog=new PopDialog(this);
and finally in the onPause
@Override
protected void onPause() {
super.onPause();
if(opened){ popdialog.dismissing();}
}
I forgot, add this to the button you call the Dialog from because sometimes it doesn't call onCreate.
opened=true;
This way when rotating, it always has the proper reference to the active dialog and calls to dismiss it destroying it. I had to update it a bit by adding the opened in there. This is won't let it call dismiss before the dialog is created.
To fix the problem in my PopDialog class that extends a Dialog, I added a
static PopDialog pd=null;
Then I added this just after the onCreate
pd=PopDialog.this;
MainActivity.opened=true;
and finally I added this method
public void dismissing(){
if(pd.isShowing()){pd.dismiss();}
}
OK, that's the hard part. Now in my main activity, I referenced it like this
PopDialog popdialog;
private static boolean opened=false;
after onCreate in that activity
popdialog=new PopDialog(this);
and finally in the onPause
@Override
protected void onPause() {
super.onPause();
if(opened){ popdialog.dismissing();}
}
I forgot, add this to the button you call the Dialog from because sometimes it doesn't call onCreate.
opened=true;
This way when rotating, it always has the proper reference to the active dialog and calls to dismiss it destroying it. I had to update it a bit by adding the opened in there. This is won't let it call dismiss before the dialog is created.
Monday, June 3, 2013
Search, settings, and power....
I needed some icons for Perspective and these are what I came up with in Fireworks cs6. The below links are saved so that they should pull up with all layers attached for easy editing or whatever you want to do with them. If you use them, feel free to download some a54studio apps:) Added a more holofied version those that want them.
https://docs.google.com/file/d/0B1I8VfqhLQvBb1FHTGozLVkyX2c/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBYXlMTWZZeW9jMVU/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBLUV0RGxhUW5DeGM/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBWVh6X1dqek1nSnM/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBYXlMTWZZeW9jMVU/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBLUV0RGxhUW5DeGM/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBWVh6X1dqek1nSnM/edit?usp=sharing
Thursday, May 2, 2013
Facebook and GooglePlus Icons
I was just simply looking for some nice icons and everything I kept finding was a low resolution image. Here are a couple ones I did in Fireworks CS6 so they can be easily modified as vectors.
https://docs.google.com/file/d/0B1I8VfqhLQvBQ1NHaWZTWmVxMHM/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBUW1QLWJZQ0U4M00/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBZ3RkeDIzdm5IUDg/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBQ1NHaWZTWmVxMHM/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBUW1QLWJZQ0U4M00/edit?usp=sharing
https://docs.google.com/file/d/0B1I8VfqhLQvBZ3RkeDIzdm5IUDg/edit?usp=sharing
Labels:
a54studio,
adobe,
android,
cs6,
facebook,
fireworks,
google plus,
googleplus,
icons,
java
Tuesday, April 16, 2013
Binary, bits, bytes, short, long, and integer.
Recently I took a class on networking and had never really put any thought into binary, but found it interesting. As some know, a byte is 256 bits of information in the range of 0-255. Below is considered an octet because it is 8 bits, yeah, 8 bits like your old NES. Below is the breakdown of how it works.
Ok, now that we understand the byte, we can understand how to use a byte in java. Still the same 8 bits of information, but a range of –128 to 127 for a total of 256. Makes sense, let's continue.
Now, with that in mind, let's compare it to a short. Yeah, I know, short isn't that common, but is 16 bit, or 2 octets. This means it has a range of –32,768 to 32,767. Below is the double octet that represents it. Notice how the number keeps doubling in the next octet.
Since that makes sense now, it only makes sense that an integer being 32 bit, is basically 4 octets that will continue doubling until it reaches a range of -2,147,483,648 to 2,147,483,647.
At this point you can understand that a 64 bit long has a range of –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
byte=–128 to 127;
short=–32,768 to 32,767
integer=-2,147,483,648 to 2,147,483,647
long=–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Ok, now that we understand the byte, we can understand how to use a byte in java. Still the same 8 bits of information, but a range of –128 to 127 for a total of 256. Makes sense, let's continue.
Now, with that in mind, let's compare it to a short. Yeah, I know, short isn't that common, but is 16 bit, or 2 octets. This means it has a range of –32,768 to 32,767. Below is the double octet that represents it. Notice how the number keeps doubling in the next octet.
Since that makes sense now, it only makes sense that an integer being 32 bit, is basically 4 octets that will continue doubling until it reaches a range of -2,147,483,648 to 2,147,483,647.
At this point you can understand that a 64 bit long has a range of –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
byte=–128 to 127;
short=–32,768 to 32,767
integer=-2,147,483,648 to 2,147,483,647
long=–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Friday, March 22, 2013
Scale text in code, regardless of screen size/density
While tinkering with TextViews, sometimes I just needed scale-able text for every device, every density. I scoured Stack Overflow and various places, but couldn't seem to land in the right spot. It would really show when running on a Kindle Fire and seemed like there should be a simple solution, and in some ways it is. You can set text sizes in XML files which isn't bad, but I wanted to control it by percentage in code and basically on the fly. Hiding in the shadows of a question, I found this lonely unchecked answer by Mark-1688382n
"I have played with this for quite some time, trying to get my font sizes correct on a wide variety of 7" tablets (kindle fire, Nexus7, and some inexpensive ones in China with low-res screens) and devices.
The approach that finally worked for me is as follows. The "32" is an arbitrary factor that basically gives about 70+ characters across a 7" tablet horizontal line, which is a font size I was looking for. Adjust accordingly."
Mark-1688382
http://stackoverflow.com/questions/2596452/how-to-scale-resize-text-to-fit-a-textview/14242816#14242816
I didn't really want to modify it much because it worked fantastically, so I just added a few tweaks. I could have swapped my incoming var with the 32.f, but got used to the way I changed it for all intents and purposes. Here is the way I call it.
smallT=getFontSize (this,1.2f);
medT=getFontSize (this,1.80f);
and here is the code to let her rip. You could really modify this any way you wish if you wish to scale your text to an exact percentage of the screen.
Hopefully this can help someone if they need scale-able text. As usual, feel free to show your support by downloading my apps from the android,blackberry, or amazon market under A54studio.
A54studio on Amazon
A54studio on Play
A54studio on Blackberry
Wednesday, March 13, 2013
SQLite Cursor explained
As I started on my Soccer Stat Master app, I realized immediately that Shared Preferences would NOT be the way to go no matter how bad my illusions of grandeur were. This led me to SQlite which went surprisingly smooth until I started messing with the cursors. A lot of my pulls from the db were a little complex so I needed to really understand the cursor function. My first dive used this.
Cursor allrows = gameDB.rawQuery("SELECT * FROM "+ PLAYERTABLE, null);
This was fine and dandy, so I used this to query what I needed. Below shows how to add to either an array or an arraylist just for reference. Anyway, the point is the cursor is aimed at row 1 and row 3. Seemed simple enough.
if(allrows.moveToFirst()){
int t;
do{
names.add(allrows.getString(1);
name[t]=allrows.getString(1); //NAME
time[t]=allrows.getInt(3); //TIME
t++;
}
while(allrows.moveToNext());
}
Now, here is where it got tricky for me mainly because I didn't understand the relation at first so I hope I can save someone else the headache. For my next call I just wanted a single item. Rather than pull the whole db just for that, I decided to use this.
Cursor allrows = gameDB.rawQuery("SELECT AGE FROM "+ PLAYERTABLE, null);
My thinking was that if I call allrows.getInt(2) it would get that row, but what didn't sink in was the cursor had already grabbed that row. After repeated errors, it hit me. The reason I was allowed to used the numbers earlier was because I was using the WHOLE db for cursor position. A simple change to 0 would fix this problem because the cursor was honed in on a row.
if(allrows.moveToFirst()){
int t;
do{
age[t]=allrows.getInt(0); //AGE
t++;
}
while(allrows.moveToNext());
}
Eventually I really needed to hone in on one by a variable added in. At this point I was beginning to grasp what was going on. Here are a few solutions for the same situation. Also, maybe they can help you understand how the cursor works by comparing them.
Cursor allrows = gameDB.rawQuery("SELECT AGE FROM "+ PLAYERTABLE, null);
if(allrows.moveToPosition(cursorPos)){
int t;
do{
age[t]=allrows.getInt(0); //AGE
t++;
}
while(allrows.moveToNext());
}
This would be the same as..
Cursor allrows = gameDB.rawQuery("SELECT * FROM "+ PLAYERTABLE, null);
if(allrows.moveToPosition(cursorPos)){
age[t]=allrows.getInt(2); //AGE
}
or even this one which hones in immediately..
Cursor allrows = gameDB.rawQuery("SELECT AGE FROM WHERE ID='"+cursorPos"'"+ PLAYERTABLE, null);
if(allrows.moveToFirst()){
do{
age[t]=allrows.getInt(0); //AGE
}
while(allrows.moveToNext());
}
Hopefully this can help clear up cursors in sqlite. Feel free to show your support by downloading my apps from the android,blackberry, or amazon market under A54studio.
A54studio on Amazon
A54studio on Play
A54studio on Blackberry
Cursor allrows = gameDB.rawQuery("SELECT * FROM "+ PLAYERTABLE, null);
This was fine and dandy, so I used this to query what I needed. Below shows how to add to either an array or an arraylist just for reference. Anyway, the point is the cursor is aimed at row 1 and row 3. Seemed simple enough.
if(allrows.moveToFirst()){
int t;
do{
names.add(allrows.getString(1);
name[t]=allrows.getString(1); //NAME
time[t]=allrows.getInt(3); //TIME
t++;
}
while(allrows.moveToNext());
}
Now, here is where it got tricky for me mainly because I didn't understand the relation at first so I hope I can save someone else the headache. For my next call I just wanted a single item. Rather than pull the whole db just for that, I decided to use this.
Cursor allrows = gameDB.rawQuery("SELECT AGE FROM "+ PLAYERTABLE, null);
My thinking was that if I call allrows.getInt(2) it would get that row, but what didn't sink in was the cursor had already grabbed that row. After repeated errors, it hit me. The reason I was allowed to used the numbers earlier was because I was using the WHOLE db for cursor position. A simple change to 0 would fix this problem because the cursor was honed in on a row.
if(allrows.moveToFirst()){
int t;
do{
age[t]=allrows.getInt(0); //AGE
t++;
}
while(allrows.moveToNext());
}
Eventually I really needed to hone in on one by a variable added in. At this point I was beginning to grasp what was going on. Here are a few solutions for the same situation. Also, maybe they can help you understand how the cursor works by comparing them.
Cursor allrows = gameDB.rawQuery("SELECT AGE FROM "+ PLAYERTABLE, null);
if(allrows.moveToPosition(cursorPos)){
int t;
do{
age[t]=allrows.getInt(0); //AGE
t++;
}
while(allrows.moveToNext());
}
This would be the same as..
Cursor allrows = gameDB.rawQuery("SELECT * FROM "+ PLAYERTABLE, null);
if(allrows.moveToPosition(cursorPos)){
age[t]=allrows.getInt(2); //AGE
}
or even this one which hones in immediately..
Cursor allrows = gameDB.rawQuery("SELECT AGE FROM WHERE ID='"+cursorPos"'"+ PLAYERTABLE, null);
if(allrows.moveToFirst()){
do{
age[t]=allrows.getInt(0); //AGE
}
while(allrows.moveToNext());
}
Hopefully this can help clear up cursors in sqlite. Feel free to show your support by downloading my apps from the android,blackberry, or amazon market under A54studio.
A54studio on Amazon
A54studio on Play
A54studio on Blackberry
Tuesday, February 5, 2013
Thursday, December 27, 2012
Increment certain values in an ArrayList.
I needed to add 1 to certain values in an ArrayList and this was the only way I could figure it out easily.
It is basically calling to set q3 at location 1 with the former q3 value +1. IN this case 6+1=7;
It is basically calling to set q3 at location 1 with the former q3 value +1. IN this case 6+1=7;
Sunday, December 23, 2012
SQLite Android and Variables
While working on a project I recently realized I was going to have to learn, or try, to save to a database. I trolled hundreds of samples and examples and after a while got a grasp. The thing that stumped me hard was if I wanted to implement a variable in the mix, or two, or an ArrayList.
Here is a brief synopsis should you encounter it.
Here is the easy way to iterate some of a db with a ListArray. Notice the " These are the crucial differences from being in sql and not.
Here is the way to update something with a variable. BOTH ways work, just showing them. I am basically adding a certain id # and location with the variable and updating it. In this case TWOS is an integer.
Here is a brief synopsis should you encounter it.
Here is the easy way to iterate some of a db with a ListArray. Notice the " These are the crucial differences from being in sql and not.
Here is the way to update something with a variable. BOTH ways work, just showing them. I am basically adding a certain id # and location with the variable and updating it. In this case TWOS is an integer.
Sunday, December 2, 2012
Vector Candle Flame Tutorial (sort of)
Today while tinkering with an app, I really needed a flame with alpha. After snapping a suitable picture I decided to use Fireworks to make one. After the fact I realized it was really very simple.
STEP 1: Take 2 circles and draw them. Next shape one like an oblong oval for the main part of the flame. Next, form the bottom to an oval and use the subselection tool form the top of that oval to match the bottom of the top oval.
STEP 2: Carefully place them together and adjust the gradient and alpha accordingly.
STEP 3: I placed a white square around the wick so you could see the detail. I basically drew a square and used the reshape area tool to make it kind of rough. I also added a little texture and adjusted the gradient. The sort of ember on the top is just a distorted shape I used and added a circle gradient in the center of it. When you place them all together you have the final product above!
STEP 1: Take 2 circles and draw them. Next shape one like an oblong oval for the main part of the flame. Next, form the bottom to an oval and use the subselection tool form the top of that oval to match the bottom of the top oval.
STEP 2: Carefully place them together and adjust the gradient and alpha accordingly.
STEP 3: I placed a white square around the wick so you could see the detail. I basically drew a square and used the reshape area tool to make it kind of rough. I also added a little texture and adjusted the gradient. The sort of ember on the top is just a distorted shape I used and added a circle gradient in the center of it. When you place them all together you have the final product above!
Saturday, November 3, 2012
As a rookie developer I find nothing more frustrating than useless comments on Google Play. Recently I got one that says "This Sucks, this app sucks bad" If it's not a good experience feel free to let me know why. I mean I'd prefer you not write a book, but emailing long suggestions would be fine too. It's not like I have 30 people working with me to make things happen, it's only one person. So Google Play, why can only the elitist developers reply to comments on Google Play? Are we not good enough for it yet? What gives, commenting started in July for some, it is November. That trial is long enough, let us in too so we can advance our business and customer relations!!!!
Friday, October 12, 2012
Android scrolling background
OK, here we are. This is how I implemented the scrolling background in Spy Jumper. Pretty simple. Basically it takes images that are width by (width/2). They are stacked on top of each other. It basically recycles one of 6 sections (or however many you want to set) to the top of the screen. Speed can be adjusted for the scrolling and I use a formula to calculate for screen densities.
In the below image is 4 different sections of background being called. 0,0,1,2,3,0
Subscribe to:
Posts (Atom)























