title: Typeface error in extended BaseAdapter class
body: <p>I am using a <code>ListViewAdapter class</code> tat extended from <code>BaseAdapter</code>,</p>
  <p>While trying to set a Custom <code>Typeface</code> for three textviews getting error after deploy to emulator.</p>
  <p>I can be able to set to a normal Activity class, but there is some logic or syntax problem in <code>BaseAdapter</code> class, Point out the error in my code and it will be appreciated.</p>
  <h2>My code</h2>
  <pre><code>import java.util.ArrayList;
  import java.util.HashMap;
  
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.graphics.Typeface;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  public class ListViewAdapter extends BaseAdapter {
  
      // Declare Variables
      Context context;
      private Activity activity;
      LayoutInflater inflater;
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; data;
      ImageLoader imageLoader;
      HashMap&lt;String, String&gt; resultp = new HashMap&lt;String, String&gt;();
      public ListViewAdapter(Context context,
              ArrayList&lt;HashMap&lt;String, String&gt;&gt; arraylist) {
          this.context = context;
          data = arraylist;
          imageLoader = new ImageLoader(context);
      }
  
      @Override
      public int getCount() {
          return data.size();
      }
  
      @Override
      public Object getItem(int position) {
          return null;
      }
  
      @Override
      public long getItemId(int position) {
          return 0;
      }
      
      
      public View getView(final int position, View convertView, ViewGroup parent) {
          // Declare Variables
          
          TextView rank;
          TextView country;
          TextView population;
          ImageView flag;
          
          inflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
          View itemView = inflater.inflate(R.layout.listview_item, parent, false);
          // Get the position
          resultp = data.get(position);
  
          // Locate the TextViews in listview_item.xml
          rank = (TextView) itemView.findViewById(R.id.rank);
          country = (TextView) itemView.findViewById(R.id.country);
          population = (TextView) itemView.findViewById(R.id.population);
          
          Typeface type = Typeface.createFromAsset(activity.getAssets(),&quot;fonts/Paprika-Regular.ttf&quot;); 
          rank.setTypeface(type);
          country.setTypeface(type);
          population.setTypeface(type);
          // Locate the ImageView in listview_item.xml
          flag = (ImageView) itemView.findViewById(R.id.flag);
  
          
          
          // Capture position and set results to the TextViews
          rank.setText(resultp.get(MainActivity.RANK));
          country.setText(resultp.get(MainActivity.COUNTRY));
          population.setText(resultp.get(MainActivity.POPULATION));
          // Capture position and set results to the ImageView
          // Passes flag images URL into ImageLoader.class
          imageLoader.DisplayImage(resultp.get(MainActivity.FLAG), flag);
          // Capture ListView item click
          itemView.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View arg0) {
                  // Get the position
                  resultp = data.get(position);
                  Intent intent = new Intent(context, SingleItemView.class);
                  // Pass all data rank
                  intent.putExtra(&quot;rank&quot;, resultp.get(MainActivity.RANK));
                  // Pass all data country
                  intent.putExtra(&quot;country&quot;, resultp.get(MainActivity.COUNTRY));
                  // Pass all data population
                  intent.putExtra(&quot;population&quot;,resultp.get(MainActivity.POPULATION));
                  // Pass all data flag
                  intent.putExtra(&quot;flag&quot;, resultp.get(MainActivity.FLAG));
                  // Start SingleItemView Class
                  context.startActivity(intent);
  
              }
          });
          return itemView;
      }
  }
  </code></pre>