Skip to main content

Posts

Showing posts from December, 2015

Custom Fonts

In android, you can define your own custom fonts for the strings in your application. You just need to download the required font, and then place it in assets/fonts folder. Y ou can access it in your java code through Typeface class. - Use  setTypeface()  method TextView textView = (TextView) findViewById(R.id. TextView1 ) ; Typeface custom_font = Typeface. createFromAsset (getAssets() , "fonts/font name.ttf" ) ; textView.setTypeface(custom_font) ;

Android Loading Control

Android Loading Control res/anim/ rotate_anim.xml <?xml version="1.0" encoding="utf-8"?> <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"     android:drawable="@drawable/img_loading"     android:pivotX="50%"     android:pivotY="50%" /> res/drawable/loading_anim.xml <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android"     android:oneshot="false" >     <item         android:drawable="@drawable/img1"         android:duration="200"/>     <item         android:drawable="@drawable/img2"         android:duration="200"/>     <item         android:drawable="@drawable/img3"         android:duration="200"/> </animat...

onClick open browser with given URL

onClick  open browser with given  URL Output : // on click its open in browser with url = http://www.google.com Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(" http://www.google.com ")); intent.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplicationContext().startActivity(intent);

Get Memory Details

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     android:paddingBottom="@dimen/activity_vertical_margin"     android:paddingLeft="@dimen/activity_horizontal_margin"     android:paddingRight="@dimen/activity_horizontal_margin"     android:paddingTop="@dimen/activity_vertical_margin"     tools:context=".MainActivity" >     <TextView         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/GET_MEMORY_DETAIL"         android:textColor="@color/Black"         android:textSize="20s...