Creating Global Session Variables for all Activities Android Example

Here is an Android example of how to share variables through out your activities and your project. There is many ways including preferences, extending from a base activity or using  a database to share variables. I like this one because it can be accessed through the whole project and it is easy to implement. The down side is that the variables are only available through a session. For example if the user restarts the application then all the variable will also be cleared. So they can be viewed as session variables.


Continue reading

Android Example Passing Variables Between Activities using Intent

Here is an example of passing variables between activities using Intent. It is easy to add extra inside an intent but unless you do it a lot then you may after reference an example.

Continue reading

Android Example of using Thread Class for Multithreading App

Here is a simple example of using the Thread Class for a Multithreading application . Shows how to use the Progress Dialog, Handler, and running on the UI Thread. Also how to handle the Looper.prepare() error (“java.lang.RuntimeException: Can’t create handler inside thread that has not called Looper.prepare()”). If you are getting this error then you are trying to do work that should be done on the UI/Main thread. I have example in the code to handle this.


Continue reading

Upload JSON Data from Android Phone to MySQL Database on Website / Server Example

Here is an example of uploading Json Data to a MySQL database on a website/Server from a Android phone.  This is great to upload user data from the phone to a website. The bad thing is  that you have to use a different Thread instead of the main UI thread. It fairly simple to multithread even though some examples  makes it pretty complicated. Check out my attempted to explain an example of using the Android Thread class.

Continue reading

Example Using Weather Underground for Android parsing XML

Small_nono_04Here is an example of requesting a XML document from Weather Underground ( to get the local weather.  The example also shows how to parse the XML document for Android (Java) after it is returned to display the weather.

Continue reading

Adding Text to a Picture using a Camera Application (Android)

If you want to add text to a picture that you took from your Android camera app that you built then you came to the right spot. This is an addition to my post Camera Application in Android Example.  So if you do not have a working camera app yet then I would recommend using the code posted there.  It is only small addition and you should not have an issue adding the code to your existing code.  Here is an example of a picture with text printed on the picture:

Camera app with text overlay
Continue reading

Creating a Camera Application in Android Example

Here is a full example of building a camera app in Android that was taken from the Google tutorial.This is the complete tested camera code all in one place with no errors. There was a few errors i got from copying and pasting the code from the Google tutorial but they are fixed in this example. I also added code to display the last image taken so the user can open the picture in a image viewer. I removed excess code without testing so comment if you are having issues so I can make corrections.

This is image for an application I created so the layout below will not include the text or ads.

This is image for an application I created so the layout below will not include the text, ads or shutter image. Check out my app in the Google Market

Continue reading

Center 2 Buttons for Any Screen Size in a Layout (Android)

Screen Shot 2013-12-03 at 2.33.39 PM

A rendering of the two center buttons

Here is how to center 2 buttons inside a layout. These do not have to be buttons but can be any type of view. The idea behind it is to create a layout and add two horizontal Linear Layout inside and assign the same weight to both.  When the buttons are inside then center the buttons inside the layout. Since each layout is set to ‘match_parent’ then it will scale to any screen size.

Continue reading

Posted in Coding


Permalink 1 Comment

Inserting Currency in a Edit Text Field with Text Watcher (Android)

Here is an example of a great way to add a currency in a Edit Text to your layout. As the user types, the numbers will update to add the decimal and the currency symbol.
Screen Shot 2013-11-21 at 4.30.38 PM


Continue reading

Using a ListView and BaseAdapter with TextWatcher

Here is a an example of repeating a cell/layout inside of a layout. The hard part I found was trying to get the text from the Edit Text field since using the id will not work. You can use the position of the cell but since the list can get rearranged due to the soft keyboard popping up. Setting a tag to the edit text field will work better.

I created two different ways to gather the input: using a holder inside the adapter and using a TextWatcher. A TextWatcher will grab the input in real time unlike a holder which will update when the focus changes.

Screen Shot 2013-11-12 at 11.06.16 AM

Here is the code:

Continue reading

Graveyard Database Logo

Has everything you want to know about grave yards. Plus has many celebrites and world leaders graves. Pssst it is my other site

Google + Profile
Check out Android Photo Mapping, its a app/site I been working on

  • wholesale sports jerseys
  • Fabulou wholesale Petr Mrazek jersey is back. Best choice to get the wholesale Petr Mrazek jersey is suitable for all style of people.