Posts

Showing posts from 2012

Android button with background

Image
     If you want to create a background for UI components like Buttons or Edit Text etc., First you have to create xml file in your drawable folder. yellow_border_gradient.xml <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FFEC8B" android:endColor="#FFFFFF" android:angle="90"/> <stroke android:width="1dip" android:color="#8E8E8E" /> <corners android:radius="5dip" /> <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /> </shape>      After creating the folder you can use the above code for designing, after saving your xml. you can call your xml in your button or any UI component. for example shown below <Button android:textSize="14

Android create temporary file in sd card

private File getTemporaryFile(Context context){ //it will return /sdcard/yourImage.tmp final File path = new File( Environment.getExternalStorageDirectory(), context.getPackageName() ); if(!path.exists()){ path.mkdir(); } return new File(path, "yourImage.tmp"); }