Thursday, December 29, 2011

Frustration, If you can help please comment

I am trying to make this simple app.
What I want it to do.
1: Show a clickable image ( imageButton)
2:When clicked  change imageButton to second image.
3:Then play a sound.
4:Wait a few seconds ( I have been using thread sleep() )
5:Change image back to the original picture.

Sounds simple right?
Well what I am getting is this.
1: Show a clickable image ( imageButton)
2:When clicked it plays the sound.
3:Waits a few seconds.
4:Then sets the imageButton to original. ( I know this part happens because I tried 3 pictures. A starting image, photo2 and last photo1 as a test to see if it was even trying to change the imageButton)

The first Image change ( step 2)  never happens , even though when I step through the app with a debugger it shows it going to that point.


package my.picture.changer;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

public class PictureChangerActivity extends Activity {

public void onCreate(Bundle savedInstanceState) {


public void setButtonClickListener() {
final MediaPlayer mp = MediaPlayer.create(this, R.raw.mysound);
final ImageButton imageButton1 = (ImageButton) findViewById(;
imageButton1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// set button image to photo2

mp.start();// play sound
sleeper();// wait 5 seconds
                                // tried moving sleep out of method to see if that made a difference (no)
// change button image back to photo1

private void sleeper() {
// wait 5 seconds

try {
} catch (InterruptedException e) {



Sunday, December 25, 2011


I learned  a nice trick in Eclipse IDE. The use of " // TODO" in your code along with window> show view >Tasks.
This allows you to create an easy way to locate a place where you need to finish coding. In the Task window it will show a list of "// TODO" that you have and when you double click on it , it will go to the spot in your code.

public class PictureActivity extends Activity {
/** Called when the activity is first created. */
// TODO I should put something here to test

I had a little bit of trouble with my Acer a100 tablet. The touch screen was not working correctly. Zooming when I was trying to scroll. After trying to find a solution online I called customer support which informed me that there is no calibration for that but that I could do a hard reset of the system. That seemed to fix the problem for now but it erases all the data on my SD card , so I had to reload that but marketplace restored all the apps I had automatically ( Though they started fresh, so my angry birds game restarted from the beginning. Meaning I had to start at level one again).
Speaking of Marketplace, couldn't they make search filtering better?
Gmail on the tablet looks like crap and most annoying is websites that automatically show mobile view instead of normal view ( perhaps I am overlooking a setting on the tablet or browser to fix that).

Appy Holidays

I refuse to say Merry Christmas ..... oh Damn, curse you holiday cheer!
(Yes I know the title is spelled wrong , it's a clever twist  on hAPPy so there spell checker lol)

Sunday, December 18, 2011

Java videos and learning aids

I have been watching a lot of videos about Java programming and this guy is probably the best at explaining Java concepts in easy to understand terms.

Also you might want to check out this learning program  called Greenfoot.

Saturday, December 17, 2011

ApiDemos and Acer A100 tablet

I have been exploring the ApiDemos example included with Android SDK. It's not to bad though Eclipse gives a lot of warnings. Some were for unused imports , which I had Eclipse fix. The app ran fine either way.

I've been having weird trouble with my new Acer A100 tablet , for some reason when viewing PDFs it wants to randomly zoom when I am trying to scroll at times. I think it is sensing double tap but there does not seem to be a way of adjusting the screen touch. Looking online for an answer you basically read that a screen cover might help but there has to be a way of doing it through software. Before I went out an bought a screen cover  I tried clear contact sheets and it does not make a difference  so I am not going to pay 14 to 24 dollars for a cover if it's not going to help. I have been using Aikido reader which does seem to handle PDFs much better then Adobe's reader