Saturday, 26 April 2014

Things to remember before getting started to Android Project

1. If you want Action Bar at top of your Android App u have to select minimum required SDK to 11.

2. If you want your customized image in your app you should put them in  drawable-mdpi folder.

3. If you want your customized Font in your app you should create a new folder "font" in  assets folder.

4. For making a request from Server to Client you must be having  in-depth knowledge about Async Task() function .

5. You must create your AVD very carefully ,So that your system don't get hanged.

6. AVD takes 10-15 minutes to get started with ,So be patient enough.... you will be needing it most while developing Android App. :)

7. Never Update or Change Auto-Generated code it will fall u in trouble.

8. You have to Access or Use  src , libs , res & AndroidManifest.xml file.

9. Before Accessing to Internet /SD Card /Internal Memory u have to give permission to your AndroidManifest.xml .

10. You must clean your  project before performing Run operation.

11. You have to check your errors in LogCat ... Unlike NetBeans Output :(

12. "System.out.print" does't work in Android ... You have to use "Log "
     
    eg:- Log.e ("Test",e.getMessage())

Creating Splash Screen

Java File : SplashScreen

public class SplashScreen extends Activity {

    // Splash screen timer
    private static int SPLASH_TIME_OUT = 1000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        new Handler().postDelayed(new Runnable() {        
            @Override
            public void run() {
                Intent i = new Intent(SplashScreen.this, SecondScreen.class);
                startActivity(i);
                finish();
            }
        }, SPLASH_TIME_OUT);
    }

}


XML File :activity_splash

<?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"
    android:background="@drawable/splash3" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="10dp"
        android:gravity="center_horizontal"
        android:text="@string/first_screen_text"
        android:textColor="#ffffff"
        android:textSize="16sp" />

    <ImageView
        android:id="@+id/imgLogo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="116dp"
        android:contentDescription="@string/logo"
        android:src="@drawable/icon" />
    
</RelativeLayout>