Back to project page Aegis.
The source code is released under:
GNU General Public License
If you think the Android project Aegis listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.decad3nce.aegis; /*w w w.jav a 2s. c o m*/ import android.content.Context; import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.ArrayList; /** * */ public class FontAdapter extends ArrayAdapter<String> { Context context; int layoutResourceId; ArrayList<String> data = null; Typeface tf; public FontAdapter(Context context, int layoutResourceId, ArrayList<String> data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; this.tf = Typeface.createFromAsset(context.getAssets(), "Roboto-Light.ttf"); } @Override public View getView(int position, View v, ViewGroup parent) { View mView = v; if(mView == null) { LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mView = vi.inflate(layoutResourceId, null); } if(data.get(position) != null) { TextView text = (TextView) mView.findViewById(R.id.text1); text.setTypeface(tf); text.setText(data.get(position)); } return mView; } }