Thursday 15 August 2013

Android Animation Using XML

In this post i am going to show you how to do animation using XML Notation and in my next post i am going to show you how to do animation using android code.

For now i will only show rotation example.

So first of all create an folder in res/ folder and name it anim as shown in image below.


Now create rotate.xml file inside anim folder and past the following code into that file.


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
   
    <rotate android:fromDegrees="0"
        android:toDegrees="360"
        android:pivotX="50%"
        android:pivotY="50%"
        android:repeatMode="restart"
        android:repeatCount="infinite"
        android:duration="600"
        android:interpolator="@android:anim/cycle_interpolator"/>

</set>
 

Now Load the animation in you activity.


public class RotateActivity extends Activity{

    TextView txtMessage;

    // Animation
    Animation animRotate;

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

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

        // load the animation
        animRotate = AnimationUtils.loadAnimation(getApplicationContext(),
                R.anim.rotate);       
    }
}

Finally start the animation using following code.


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

Similarly you can create xml files for other animations too and can use in your activity.

Tuesday 14 May 2013

Silly Mistakes

In this post i am going to write silly mistakes i use to make when  was novice to android .... keep in mind following point to avoid silly mistakes .

1) Always give height and width to every view Or element you write in xml file.

Example :
              incorrect :
                    <TextView
                           android:id="@+id/imeitext"
                           android:textColor="#5c5c5c"
                           android:text="@string/text" />

         
              correct :
                   <TextView
                           android:id="@+id/imeitext"

                           android:layout_height="wrap_content"
                           android:layout_width="wrap_content"
                           android:textColor="#5c5c5c"
                           android:text="@string/text" />



2) When ever you use layout for different devices like layout-ldpi,layout-hdpi, etc. never  forget to include xml which is used to for designing purpose of activity in all the folders.
if you forget then it will give error that no id found for the devices which ever fall in category in which you forgot to include xml file.

Example:

you have folders like layout-hdpi and layout-ldpi you have xml file in layout-hdpi and not in layout-ldpi then when every you deploy you application in the devices fall under ldpi category will prompt an error until you include the xml file in layout-ldpi folder.

Saturday 11 May 2013

Beatfreaker's Dictionary

Visit online dictionary developed by me, by visiting link given below :
Click Me

This dictionary is build my me using an fusion of web services.

Using this Online Dictionary you can get meaning, synonyms and rhyming word of an word you will be searching for.

Recently i am working on developing same application on android .... if you want to share any ideas or suggestion post here or you can send an email to radiachints1512@gmail.com

Have a look at snapshot of my web-application 



ArrayList

ArrayList which i use the most .... 

Array means collection of same type of data and blah blah blah !!
 

you will say if there is Array then why to use ArrayList??
 

the basic difference between this two is Array are of fixed size Whereas an ArrayList implements the list data structure and can dynamically grow.

one more difference between Array and ArrayList is that you can create instance of ArrayList without specifying size while we have to provide size while creating instance of Array


example of Arraylist :

    ArrayList<String> countries = new ArrayList<String>();
    countries.add("India");    //This will add India to countries ArrayList
    countries.get(0);            //here you have to provide index as argument in total this line
                                        //will give you value present at that index

some other methods :

 countries.contains("India");   //returns true if argument you pass is present in list else false
 countries.clear();               //clear all the elements present in ArrayList      


for more detail visit follow link :
http://developer.android.com/reference/java/util/ArrayList.html                                    

Friday 10 May 2013

First Post

Hello World !!

I am Chintan Radia,

Recently completed B.Tech in computer engineering .... i developed an market place in my final year project and in last decided to write blog to share solution of various task i have faced while developing the project .... as being an android developer its tough to know about every thing which you are going to use in your applications and its tough too to find all the damn thing at same place .... so in this blog i am going to share some tutorials or codes to achieve some task or which can be useful to those who are going to develope applications in android ....

I am not just going to post just about android as i am music freak too so some of the post can be contain info about music i like or latest popular songs .... and in part time i dance too so i'll also be posting links of my dance videos .... :)