Hey guys, I was wondering if someone could help me interpret line by line what is happening in this code...

package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TextView tv = new TextView(this);
       tv.setText("Hello, Android");
       setContentView(tv);
   }
}

I don't know much about Android development, but I know it's very similar to a 'normal' Java programming environment.

For this specific piece of code:

AFAIK,

super.onCreate(savedInstanceState);

is what returns information to the application in the event that an activity is interrupted (restart, detroyed, etc), if that makes sense.

In main, a 'tv' object is being created from the class 'TextView' which I am guessing is part of the Android SDK package.

Here it is: http://developer.android.com/reference/android/widget/TextView.html

a class-specific function is then called:

tv.setText("Hello, Android");

along with what looks to be pre-defined function with the object as an argument:

setContentView(tv);

I would suggest reading up on this site to learn as much as you can about the Android SDK:

http://developer.android.com/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.