Thursday, May 2, 2013

Change circle image of radio button android

change circle image of radio button

go to drawable folder and create a xml file named button_radio.xml

paste this in button_radio.xml file


<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/radio_on" android:state_checked="true" android:state_pressed="false"/>
    <item android:drawable="@drawable/radio_off" android:state_checked="false" android:state_pressed="false"/>

</selector>


now downlaod these images radio_off.png , radio_on.png here


put these images in drawable folder

now in Activity file
put


RadioButton rb1;

rb1.setButtonDrawable(R.drawable.button_radio);





Wednesday, May 1, 2013

Use external fonts in android programming

Use hindi fonts android programming
Use external fonts android programming

Inside the assets folder of your project create a new folder and name it as fonts. Copy the font(.ttf) files in this folder. In our case the font files are RockFont.ttf and FEASFBRG.TTF.


setContentView(R.layout.main);
        Typeface font1 = Typeface.createFromAsset(getAssets(), "fonts/RockFont.ttf");
        Typeface font2 = Typeface.createFromAsset(getAssets(), "fonts/FEASFBRG.TTF");
        TextView customText1 = (TextView)findViewById(R.id.text1);
        TextView customText2 = (TextView)findViewById(R.id.text2);

        customText1.setTypeface(font1);
        customText1.setTextSize(40.f);
        customText1.setText("Hello! This is a custom font...");
        
        customText2.setTypeface(font2);
        customText2.setTextSize(30.f);
        customText2.setText("Developed by www.bOtskOOl.com");
        
  

Monday, April 29, 2013

Button Animation android



Button Animation android
create folder anim in res folder
then create xml file name anim_rotate.xml

paste this to anim_rotate.xml

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


now declare this in Activity

final Animation animRotate = AnimationUtils.loadAnimation(this, R.anim.anim_rotate);

Button b1 = (Button)findViewById(R.id.button);
b1.startAnimation(animRotate);

Friday, April 26, 2013

Tuesday, April 16, 2013

set package install location android


set application install location android
set install location to sdcard android

put android:installLocation="preferExternal"

under <manifest xmlns:android="http://schemas.android.com/apk/res/android">
in menifest.xml file


code should appears like

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal">

for setting install location to phone put "preferInternal" in place of "preferExternal"

Create Transparent button android



make button transprent android
android transparent button


put this in xml file of button

android:background="@android:color/transparent"