Thursday 9 January 2014

AAPT Filing With Error Code -1073741819

You will get this error while you have written wrong in main.xml file in menu. 

Solution : 

Please correct the id/string in xml file & rebuild the application. It will resolved your problem 100%. 


Wednesday 8 January 2014

Android Status Bar Height

Android Status Bar height for the respective resolution



For android development require to minus(-) the respective height from the total height. 

Wednesday 1 January 2014

Android FlashScreen Animation

Android Flash Screen Sample code, You can use this classes before the HomeScreen of the application.


MainActivity.java

public class MainActivity extends Activity implements AnimationListener {

TextView txtMessage;

// Animation
Animation animFadein;
Animation animFadeout;

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

txtMessage = (TextView) findViewById(R.id.txtMessage);

// load the animation
animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.fade_in);
animFadeout = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade_out);
// set animation listener
animFadein.setAnimationListener(this);
animFadeout.setAnimationListener(this);
txtMessage.setVisibility(View.VISIBLE);

// start the animation
txtMessage.startAnimation(animFadein);

}

@Override
public void onAnimationEnd(Animation animation) {
// Take any action after completing the animation

// check for fade in animation
if (animation == animFadein) {
txtMessage.startAnimation(animFadeout);
}
if(animation == animFadeout){
Toast.makeText(getApplicationContext(), "Animation Stopped",
Toast.LENGTH_SHORT).show();
}

}

@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub

}

@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub

}

}


Layout File : activity_main.xml

<?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:orientation="vertical">
    
    <TextView android:id="@+id/txtMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Flash Screen"
        android:layout_centerInParent="true"
        android:textSize="25dp"
        android:visibility="gone"/> 
        
    
</RelativeLayout>

Animation Files :

1. fade_in.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <alpha
        android:duration="1000"
        android:fromAlpha="0.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="1.0" />

</set>


2. fade_out.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <alpha
        android:duration="1000"
        android:fromAlpha="1.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="0.0" />

</set>