As a young programmer when I needed an answer to a question like "Creating arrays in Java" or "why not to use goto?" I always googled it first. The first links were of course stackoverflow links, that 90% of the time had an answer. This made my studying alot easier. Its really nice to ask questions and have immediate answers, we programmers have it easy we can just google something for programming and if its not to complicated we find and answer. Now imagine someone studying mathematics and searching "taylor" for taylor series a bunch of Taylor Swift songs will come up, how sad is that :(.

I always used stackoverflow as a source for quick answers to my questions, but I never really asked a question on stackoverflow, I didnt understand the voting system, how to actually answer a question, what was the difference between a tick near an answer. Using Stackoverflow[dot]com back then was really just to read a question see if its the same question as mine and check the answers.

So I wanted to give back and be apart of the whole Stackoverflow community answering questions, giving votes, so I opened an account and I entered the crazy world of Stackoverflow. First of all I couldn't comment, ask questions, or give votes because I was just a newbie at the site, it required me to have more votes(reputation).

So all I was left was to start answering questions, which I did and I found it really amazing, other developers even wrote to me on Google+. One of the best comments I got on an answer was this "You, sir are a genius. Thanks a lot! Works like a charm" here's the link . 

Now I use Stackoverflow[dot]com everyday It feels really nice helping other developers.

fun fact: two farmers use Stackoverflow[dot]com :).

Here is my stackoverflow user account


Your system is running in low-graphics mode


So my biggest problem with my new laptop which is Lenovo G510 was that Ubuntu 14.04 and older versions of Ubuntu just wouldn't recognize my graphics card which is AMD HD 8500M. The following error was always shown Your system is running in low-graphics mode I tried installing the drivers from terminal those fglrx drivers but that didn't work, I found a work around that made Ubuntu work like a charm these are my Lenovo G510 tech specs:

Intel® Core™ i5-4200M (3.10GHz 1600MHz 3MB) 
15.6" high-definition (1366 x 768) / 200 nit display, 16:9 widescreen 
AMD/ATI Radeon HD 8500M 
4GB RAM

So change the setting into the BIOS from:

  • "Switchable graphics"  
  • "Hybrid graphics"

to

  • "UMA graphics" 
  • "On-board graphics"
  • "Intel Graphics"


after its possible to use intel video card with proper drivers on Ubuntu, but you will lose your Switchable graphics capabilities, and if your Wifi drivers don't work plug in a cable and go to additional drivers in System Settings you'll see a check box or something there :).


I'll show you how you can create a countdown timer and add it to your ActionBar, its really simple.

So first open menu.xml which is in res/values/menu.xml and add this item to it:

<item
            android:id="@+id/counter"
          
  android:title=""
            android:showAsAction="always">
</item>

then in your Activity that you want to show the countdown timer, replace the code in "public boolean onCreateOptionsMenu(Menu menu)" with the code below: 


long timer = 10000;
public
 Boolean onCreateOptionsMenu(Menu menu) 
{

        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.menu, menu);

       
final MenuItem  counter = menu.findItem(R.id.counter);
        new CountDownTimer(timer, 1000) {

          public void onTick(long millisUntilFinished) {
            long millis = millisUntilFinished; 
            String  hms =  (TimeUnit.MILLISECONDS.toHours(millis))+":"+                    (TimeUnit.MILLISECONDS.toMinutes(millis) -             TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(millis)))+":"+ (TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis))); 

            counter.setTitle(hms);
            timer = millis;
           
            }

        public void onFinish() {
            counter.setTitle("done!");
            }
         }.start();

         return  true;

 }




If you want to set the countdown time to a different value, then just change the timer variable to a different value, the timer should be in milliseconds

1 second = 1000 milliseconds
1 minute = 
60000 milliseconds
1 hour    = 3600000 milliseconds

This is how it looks like :
 



Google's hidden a weird easter egg in Android L.
The easter egg is hidden in  Settings->About phone-> Android version number. just tap a bunch of times on the Android version number and you'll see random red and blue rectangles that mystified the web earlier this year. A youtube channel called "Webdriver Torso" holds the videos of these really weird blue and red rectangles. Someone "Google" must of put them there cause it hold of taken 270 days to edit and upload them to youtube.Here is the link to the youtube channel :
https://www.youtube.com/watch?v=3H63S_zowUw



I found this really cool online Action Bar style generator, its really easy to use and its open source which I thought that was nice.

Heres the link :

http://jgilfelt.github.io/android-actionbarstylegenerator/


This is a theme i made for an app it has a Action bar with 3 tabs



I was working on an app that I didn't want the activity page to rotate horizontally even if the user flips his/her phone around. So this is the code and steps I used to stop the screen from rotating/changing its orientation, however you want to call it :

1. Open AndroidManifest.xml
2. Inside AndroidManifest.xml find the activity of the screen that you don't want to rotate even if the user flips the phone:

<activity 
            android:name="com.example.MainActivity"
         
  android:label="@string/app_name"

            />


3. Add this line ->   android:screenOrientation="portrait"


<activity 
            android:name="com.example.MainActivity"
            
android:label="@string/app_name"
            android:screenOrientation="portrait"

            />



My app design would look bad on tablets so i wrote this code to get the devices type (tablet or phone) :

public boolean isTablet(Context context)
{
        return
 (context.getResources().getConfiguration().screenLayout 
             & Configuration.SCREENLAYOUT_SIZE_MASK ) >= 
                Configuration.SCREENLAYOUT_SIZE_LARGE;
}


then i changed the design layout based on the device type that was returned from the method isTablet(); with this code:


boolean  tablet = isTablet(this)
       
     if (tablet)
               setContentView(R.layout.tablet_design);
            else 
               setContentView(R.layout.phone_design);




Some rumors say that Androids new version will be called Lollipop, One thing that I have noticed about Androids OS names is that they are in an alphabetical order:

Alpha
Beta
Cupcake
Donut
Eclair
Froyo
Gingerbread
Honeycomb
IceCream Sandwich
JellyBean
KitKat

So thats C - K so COOL!! so when is Lollipop coming out i guess somewhere around november when the new Nexus 6 comes out.