Skip to main content

Featured

Android studio “SDK tools directory is missing”

Following 2 possible solutions will resolve this problem :  Solution1 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:" Delete your  ~/.Android*  folders (losing all of your settings :/). Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again (and fails due to my rubbish internet). Click the X on the wizard window. That will enable you to get to the normal welcome dialog. Go to Settings->Project Defaults->Project Structure and change the Android SDK location to the correct one. Solution 2 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:...

Code to Set CustomFont for EditText through .XML file,Android.

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.EditText;

public class CusFntEditText extends EditText{

    private Context c;
    public CusFntEditText(Context c) {
        super(c);
        this.c = c;
        Typeface tfs = Typeface.createFromAsset(c.getAssets(),
                "Futura.ttc");
        setTypeface(tfs,Typeface.BOLD);

    }
    public CusFntEditText(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        this.c = context;
        Typeface tfs = Typeface.createFromAsset(c.getAssets(),
                "Futura.ttc");
        setTypeface(tfs,Typeface.BOLD);
        // TODO Auto-generated constructor stub
    }

    public CusFntEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.c = context;
        Typeface tfs = Typeface.createFromAsset(c.getAssets(),
                "Futura.ttc");
        setTypeface(tfs,Typeface.BOLD);

    }}
--------------------------------use above code like this :
<com.sfa_test.CusFntEditText
            android:id="@+id/tvBSAccNo"
            android:layout_width="150dp"
            android:layout_height="40dp"
            android:layout_marginLeft="10dp"
            android:background="@android:color/transparent"
            android:gravity="center|left"
            android:text=""
            android:textColor="#2c3c36"

         android:textSize="10pt" />

Comments

  1. Hi Everybody - This is a great place for android developers.
    This post was very helpfull for me.

    Thank alot and you have a great future man.


    ReplyDelete

Post a Comment