Pages
Thursday, December 1, 2011
Update: Version 2.0
https://market.android.com/details?id=com.jmarstudios.txtautoresponder.android
I wrote a blog post about it here: http://jmarstudios.com/2011/11/29/update-version-2-0/
Enjoy :)
Saturday, October 15, 2011
Skribblit!
You can download Skribblit here: https://market.android.com/details?id=com.jmarstudios.skribblit
Enjoy! :)
Friday, October 7, 2011
My New Site! JMaRStudios.com
Anyway, that is where I will be posting from now on. Hopefully you will join me :)
Thank you for reading!!!
Wednesday, October 5, 2011
Why Does My ListView Look Different?
If you like the gray bottom-of-list background on the Motorola Android 2.3.x devices, and you want your application to blend in with the device rather than look the same across devices, then you’re set. You don’t need to do anything.
The simple fix
But if you (or your client, or users) want the ListView background to display at full screen, or your application to look the same across multiple devices, there’s a simple solution.
How can there be a "simple solution" to wanting what I expect to be the default behavior... looking the same across all devices?
I understand that the manufacturer's are "allowed" to do this. But is that really a good thing? I mean, Motorola actually went out of their way to break the consistent user experience and force it on the developer to do some stupid workaround.
I feel like this fragmentation issue is getting just a tad bit ridiculous...
http://community.developer.motorola.com/t5/MOTODEV-Blog/Why-Does-My-ListView-Look-Different/bc-p/18521
Saturday, October 1, 2011
Using Custom Fonts With Android
Custom fonts use the TypeFace class.
First find yourself a nice font... I found and will use this one here called "Cheyenne Hand" at 1001 Free Fonts.
After downloading and unzipping the file, add the ttf font file to your project in the following directory:
assets/fonts/[fontname].ext
Now in your layout file (main.xml in this case) you would create a TextView as you normally would...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:id="@+id/textViewDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Default Font Text..."
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:textSize="30sp" />
<TextView
android:id="@+id/textViewCustom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Custom Font Text..."
android:textSize="30sp"
android:layout_below="@+id/textViewDefault"
android:layout_alignParentLeft="true"
android:layout_marginTop="100dp" />
</RelativeLayout>
Now in your activity you create a TypeFace object.
Typeface tf = Typeface.createFromAsset( getAssets(), "fonts/cheyenne_1.ttf" );
Then get the TextView
TextView tv = (TextView)findViewById( R.id.textViewCustom );
Then bind the TypeFace to the TextView
tv.setTypeface( tf );
Now take a look and you will see something like this...
Tuesday, September 27, 2011
When does assigning variables become more efficient than $_POST?
**NOTE: I wrote this a really long time ago (February 1, 2009) on another blog I used to have and wanted to move some of the articles over here to consolidate them.To answer the question presented by the article title... All the time!
I was tooling around today and ran across this little gem...
This may not be a big deal, but I'm just kinda curious. If I have a page that submits a form to itself, when is it better to assign each element in $_POST to a variable to use for the rest of the page?
My situation probably doesn't make a difference, but say I have about 10 form fields, and when the page is posted back to itself, i call each of those form fields 2 times (1 for error checking, 1 for SQL insert, or to pre-fill form).
So where does it become more efficient to only call $_POST once and assign those to variables? Do you use the variables if they are needed any more than one time?
Thanks for you thoughts!
IMHO that is a great question!
I believe that the question is best addressed in two parts.
- Variable \Reuse
- This is the one I would like to focus upon today.
- Benchmarking
- This was addressed by the poster already read response here
Variable Reuse
Anytime that you plan on using data from the $POST variable (or any request data $_REQUEST, $_GET, et al) in more than one place, it is good practice to contain that data in a variable.
Why?
Let's say you have a name passed into your script via a form that a user submitted. Our POST data could look something like this:
$_POST['firstname'] == 'John'$_POST['lastname'] == 'Smith'
So anytime we want to do something with the first name we simply use the variable
$_POST['firstname']
// Will output John
echo 'First Name: ' . $_POST['firstname'];
That's nice and easy... but if you do plan to use that technique remember, there's a catch!
Anyway, this potential dilemma is easily solved by containing that data in one central location... a variable.
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
Now since your data is contained within its own variable, if the key changes you only have to edit one time and it will be seen throughout the rest of the script!
Example:
// This example shows the benefit of using variables to contain request
// data request values
// $_POST['firstname'] == 'John'
// $_POST['lastname'] == 'Smith'
// Since we are containing the data here then this ends up being the
// only place that the post key has to be changed.
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
function showFullName() {
echo $firstname . ' ' . $lastname;
}
function insertRecord() {
$query = "INSERT INTO mydb.ppl VALUES ($firstname, $lastname);
}
Working On Another Site
I have been working on another site recently for a small business located in Tampa Florida called Avalon Transcription and Document Preperation, LLC.
Take a look at it and let me know what you think :)
Avalon Transcription and Document Preparation, LLC
![]() |
New Version |
![]() |
Old Version |
Thursday, September 22, 2011
Two New Sections (Pages)
![]() |
Image: Danilo Rizzuti / FreeDigitalPhotos.net |
The FAQ page is just starting so there is very little content just yet.
The "My Response to Android Marketplace Comments" page has comments and my responses starting from September 1, 2011
Enjoy :)
Saturday, September 17, 2011
Just For Fun...
Let me know what you think so far :)
Monday, September 12, 2011
Newest Update w/ Screen Shots
- Major update to the UI (User Interface)
- Bug fix in the home screen widget
- Added AdMob ads...
- Hopefully these ads will help to offset some of the financial costs that go into maintaining and creating new features for SMS Text Auto Responder.
FREE: https://market.android.com/details?id=com.jmarstudios.txtautoresponder.android&feature=more_from_developer
Of course you can always purchase the DONATE version and do away with the ads... FOREVER!!!
DONATE: https://market.android.com/details?id=com.jmarstudios.txtautoresponder.donate&feature=more_from_developer
Thursday, August 11, 2011
YAY!!! Working on a new site...
She is living the dream... you should check it out.
[http://angelaaverett.com]
Saturday, July 30, 2011
SMS_RECEIVED priority level problem in apps
SMS_RECEIVED priority level problem in apps
Thursday, July 14, 2011
Android: SharedPreferences and Generics Part 1
I like to use Android application resources (R class), SharedPreferences and Generics together at the application level to create a real quick and stable system of saving and retrieving simple stored data throughout an entire application.
...extends Application
First I'd like to take a minute and talk about extending the Application class. Usually this is not necessary nor is it a good idea. I believe however, that this is a good way to extend the Application class. It allows easy, consistent access to our SharedPreferences throughout the application and not just in an Activity or Service. It really shines when you create a stand alone class. Using this method you won't have to pass the context around... which can get out of hand real fast!
A little about SharedPreferences...
How do SharedPreferences work and why would I need them?
Android provides many different ways of storing and retrieving data. You could use a premade file, a file on the external storage (microSD) or you could even use the SQLLight database that is provided to you through a content provider.
These are all great and effective methods of storing data but they each come at a cost. Using files creates overhead using the file IObuffer, writing to a database can be painfully slow when writing many times in a short timespan, the list goes on.
So for example, if I have some simple data and it may or may not be written and re-written many times throughout the application's lifecycle, I don't want to have to create DB handlers, calls to content providers and queries and buffered readers and lions and tigers and blah blah blah whatever... just to manage the data.
This is where the SharedPreferences class really shines! Reading and writing data using SharedPreferences is extremely fast, secure (only YOUR application has access to the stored data) and overall easy to use. Simply put SharedPreferences are a quick and easy storage solution that has the ability to store data in key/value pairs.
Here is a simple breakdown of what you can use for the key and the value:
Key: Currently, the key is always a value of the type String.
Value: Currently SharedPreferences only supports storing the following value types:
- String
- Integer
- Float
- Long
- Boolean
How to use SharedPreferences
To use the SharedPreference class you must first get a handle to the file.public class SomeClass {
private SharedPreferences mSomePref;
public SomeConstructorOrOnCreate() {
mSomePref = this.getSharedPreferences( "pref_filename_no_extension", MODE_PRIVATE);
}
}
Then if you want to put some data, say a string, into that preference file you would do so like this:
private void someMethod() {
// Do some work...
// Get a handle to the shared preferences editor
SharedPreferences.Editor edit = mSomePref.edit();
// do the work
edit.putString("myKey", "My value which is the type: String");
// commit() must ALWAYS be called after doing all the work. If it is not
// then the changes will NOT be commited!
edit.commit();
}
Now to retrieve that data we call like this:
// Get the value of the preference
String storedPref = mSomePref.getString("myKey", "Some default value to return if this key doesn't exist");
AWESOME!!!
Yeah, all the way until you need to add another preference OR you need to update that one you just set...
private void anotherMethodThatChangesTheStoredPref() {
// ...do some work...
// Need to change the value of my key
SharedPreferences.Editor edit = mSomePref.edit();
edit.putString("myKey", "The new value that will overwrite the previously stored value");
edit.commit();
}
Ah, now I see an encapsulation issue. No problem right? Separate adding the preference into its own method and pass the value in with a parameter.
private setSharedPref(final String key, final String value) {
SharedPreferences.Editor edit = mSomePref.edit();
edit.putString(key, value);
edit.commit();
}
So now we can call it from various methods...
private void methodOne() {
setSharedPref("myKey", "Some string value");
}
private void methodTwo() {
// We can update the existing value...
setSharedPref("myKey", "A new string value");
// Or we can add a new entry altogether
setSharedPref("newKey", "Some string value");
}
This is great! However, we run into an issue when we want to store some other type of data other than strings. What if we want to store a Float or a Boolean? Well we would need to create a method for each type.
private void setStringSharedPref(final String key, final String value) {
SharedPreferences.Editor edit = mSomePref.edit();
edit.putString(key, value);
edit.commit();
}
private void setFloatSharedPref(final String key, final float value) {
SharedPreferences.Editor edit = mSomePref.edit();
edit.putFloat(key, value);
edit.commit();
}
private void setBooleanSharedPref(final String key, final bool value) {
SharedPreferences.Editor edit = mSomePref.edit();
edit.putBoolean(key, value);
edit.commit();
}
// so on and so forth...
This is ok but a lot of repetitive code, especially if you want to use your shared preferences in another class because you will have to repeat all this code in that class as well. There has to be a better way, right? Breathe easy people... there is!
Introducing Generics woot woot!!!
Since we may need to insert any one of a number of value types a generic method would be an excellent solution here. A generic method allows you to pass an unknown type using the generic type identifier (usually something like <T>) into the method and it is up to you to determine what was passed and handle it accordingly.
To do this I use a series of if/else statements and check if the class matches the type using getClass().equals(Type.class)
So with that said, our new method would look like:
private final <T> void setSharedPref(final String key, final T value) {
SharedPreferences.Editor = mSomePref.edit();
if(value.getClass().equals(String.class)) {
edit.putString(key, (String)value);
} else if (value.getClass().equals(Boolean.class)) {
edit.putBoolean(key, (Boolean)value);
} // So on and so forth...
edit.commit();
}
This way allows you to not care what value type you are attempting to passSo as you can see thus far the SharedPreferences class is a really fast and powerful way of managing simple data and using generics really takes them to the next level!
In the next post I will tie everything together and then demonstrate how to use all of this in a "real world" example.
Sunday, July 10, 2011
Whew...
Lots of good stuff in this update too...
- Fixed not sending issue on some devices!
- Fixed battery issue on some devices!
- Major overhaul in how incoming numbers are handled
- Fixed crash involving screen orientation change while update dialog is showing
- Fixed crash related to empty outgoing responses
- Added two new auto response categories and response values
- Bad Mood
- Theater
- A ton of code enhancements and bug fixes!
You can find the latest version here...
SMS Text Auto Responder FREE
and as always if you would like you can always help by purchasing my donate version on the Android Marketplace...
SMS Text Auto Responder DONATE
Monday, July 4, 2011
Whoops! Bug Alert!!!
I should have a fix for this soon...
Tuesday, June 28, 2011
Icons and Icon Decorations in Eclipse
Thanks to Lord Torgamus for the excellent answer on StackOverflow!
His answer (as found on StackOverflow)
This is a fairly comprehensive list from the Eclipse documentation. If anyone knows of another list — maybe with more details, or just the most common icons — feel free to add it.
Helios: http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-icons.htm
Galileo: http://help.eclipse.org/galileo/topic/org.eclipse.jdt.doc.user/reference/ref-icons.htm?resultof=%22icon%22
There are also some CDT icons at the bottom of this help page.
If you're a Subversion user, the icons you're looking for may actually belong to Subclipse; see this excellent answer for more on those.
Monday, June 27, 2011
New Update and New Donate Version!!!
Lots of fun stuff to announce...
- There are many code enhancements...
- Added the crash reporting library: ACRA (Application Crash Report for Android)
- Enable showing the outgoing auto response in the stock SMS application.
Note: This may not work on all devices. If you experience any issues with this feature go to Settings and disable it then send me an email letting me know what type of device you are using. I will see if there is a fix that I may be able to implement. - Added Donate feature to the settings menu
- Added a Donate version to the Android Marketplace which can be purchased for $1.99USD
- Updated graphical elements
- Various major & minor bug fixes
- Fixed a low memory error on SOME devices
- Many other nifty things!!!
You can download the main app here: SMS Text Auto Responder FREE
You can contribute to the cause here: SMS Text Auto Responder DONATE
Thursday, June 23, 2011
Wednesday, June 22, 2011
Simple communication between two different applications
Recently, I faced a problem where I needed two different applications to communicate a simple message between each other. I searched around and found many questions regarding this problem. However, there were a lot of vague answers as well.
I figured I would write this in case someone else faced a similar issue and needed a starting point to work from.
Here was the issue I faced:
- The user opens TestAppOne and there is a check to see if TestAppTwo exists.
- For this example we will say that TRUE is returned.
- Since TestAppTwo exists we open it using startActivityForResult(Intent, int).
- When the user is done with TestAppTwo they click a button which sends them back to TestAppOne with the resultCode
- Call finish() on TestAppTwo.
class TestAppOne extends Activity {
//...
private final void startOtherApp() {
//...
// Here we pass "1" to TestAppTwo
this.startActivityForResult(intent, 1);
//...
}
@Override protected void onActivityResult(int pRequestCode, int pResultCode, Intent pData) {
super.onActivityResult(pRequestCode, pResultCode, pData);
// Check the result code that was sent from the calling activity
if( pResultCode == 1 ) {
// The result was successfully sent and received
} else {
// There is something wrong
}
}
}
class TestAppTwo extends Activity {
//...
private void someMethod() {
//...
// Set the result here to be passed back to TestAppOne
this.setResult(1);
this.finish();
}
}
Credits go to:
Android Developer Reference
Let's Share Some Thoughts
Android Forums
Monday, May 30, 2011
Hopefully...
YAY!!!
The only time I could get it to reproduce the error was when there were SMS messages coming in and the auto responder was trying to send one out at the exact same time. The stock app would attempt to automatically resend the message and retrieve the incoming message at the same time... however what winds up happening is they both keep blocking each other.
Think two people facing each other attempting to go through the same door and each time one moves one way the other inadvertently moves the same direction thus blocking the doorway.
Hopefully it doesn't do this any longer!
Friday, May 13, 2011
AndEngine: Thoughts and Background How-To
I will say this though...
With all due respect, as amazingly awesome and powerful as this library is it is extremely hindered by its lack of clear and easy to find documentation. It is like pulling teeth trying to figure this thing out! Oh well, if it was easy it wouldn't be fun right!?!??!
Anyway, one of the things I was trying to do was set a static background.
There is probably a better way of doing this but this worked for me.
The way I've done it is as follows...
Landscape mode
I have the camera width and height set at: 854x480
The .jpg image that I use as a background is 854x480
Note: because you need to use a texture that is a power of 2 I had to set the texture area at 1024x512. This didn't seem to affect it.....yet!
@Override
public void onLoadResources() {
// Create a texture to load our sprite into
this.mBackgroundTexture = new Texture(1024, 512, TextureOptions.DEFAULT);
// Create a region to load the image asset into
this.mBackgroundRegion = TextureRegionFactory.createFromAsset(this.mBackgroundTexture, this, "gfx/YOUR_IMAGE.JPG", 0, 0);
// Load the texture (with the region that holds the asset) into the engine
this.mEngine.getTextureManager().loadTexture(this.mBackgroundTexture);
}
@Override
public Scene onLoadScene() {
// Do scene work...
// Might not need this but I did it anyway...
this.setBackground(new ColorBackground(0, 0, 0, 1));
// Create sprite
this.mBackground = new Sprite(0, 0, this.mBackgroundRegion);
//Attach the sprite to the scene. I use getFirstChild() so that I can ensure that the background sprite is the "bottom" child
scene.getFirstChild().attachChild(this.mBackground);
// Do some other work maybe...
return scene;
}
I will write up a more thorough tutorial soon!
Hope this helps :)
Blogger Buzz: Blogger is back
Monday, March 14, 2011
Sunday, March 6, 2011
Please Help Me Help You!
When a person leaves a comment on the Android Marketplace I have no way of helping that person. I, as a developer, cannot reply to the comment. I cannot gather more information as to what is happening. All I can do is sit and guess what is happening.
In my last app update I introduced an email button so it would make it easier for a user to contact me directly. Why are they not using it?
So I say... Please Help Me Help You!
I take great pride in my work. I want YOU to have the best, most solid application that I can build! So if you use SMS Text Auto Responder FREE and experience an issue with the application, I implore you to let me know directly.
Monday, February 28, 2011
1000+ DOWNLOADS!!! WOOT!!!
Friday, February 25, 2011
SMS Text Auto Responder FREE... Bring on the widget!!!
Hell Yeah!
The only major thing I would like to wrap up is really just a minor annoyance... The status bar notification only updates once when the app AutoResponds.
Now on to creating the homescreen widget for the AutoResponder app... WOOT!!!
Thursday, February 24, 2011
Big update!
I just released a big update to the auto responder!
Initially I made the broadcast receiver using a seperate class and added it through the manifest. While it worked good, doing it that way meant that ANY time an SMS message came in the receiver caught it and started the service. This is a good thing if one wants that sort of functionality. I, however, only want the service running if the user explicity turns it on.
To make sure it behaved properly, I set a boolean flag of sorts when the user started the auto responder. I then checked if that flag was true whenever the service started. If it was false then i had the service shut itself down.
This works good for sure but it never sat well with me.
Now I am using a dynamically registered BroadcastReceiver within my service which is *only* registered when the service is created!
I think this is a much better solution ;)
Sunday, February 20, 2011
idea for my text responder application...
i'm thinking of adding a response log in the options menu so that the user can have a visual record of when SMS Text Auto Responder FREE auto responded to incoming text messages.
Friday, February 18, 2011
SMS Text Auto Responder FREE... Released!
You can check it out here...
App Name: SMS Text Auto Responder FREE
Link: http://market.android.com/details?id=com.jmarstudios.txtautoresponder.android
I am extremely happy :)
Monday, February 14, 2011
SMS Text Auto Responder (txtAutoResponder) for Android
Here are some screenshots...