In order to provide a custom typeface in my ListActivity, I wrote a class CustomAdapter extending BaseAdapter according to this example here.
However, as described there, I wrote the getView() method like following:
public View getView(int position, View convertView, ViewGroup parent){
String gameName = gameNames[position]; // gameName ist the String[] of the Custom Adapter
TextView tv = new TextView(context);
tv.setText(gameName);
tv.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/gulim.ttf"));
return tv;
}
This works as intended. The only disturbing thing is that it takes about three or four seconds until the list shows up (and this is a very long time in this context). However, in the ListActivity I set the onItemClickListeners like this:
private void setOnItemClickListener(){
getListView().setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int pos, long id){
onClickEntryButton(((TextView) view).getText().toString());
}
});
}
private void onClickEntryButton(String gameName){
Intent intent = new Intent(this, GameActivity.class);
intent.putExtra("gameName", gameName);
startActivity(intent);
finish();
}
Now when clicking on a ListItem, it takes even more time until the GameActivity opens. This Activity is just a couple of TextViews filled with information taken from a SQLite database. Also here, I set a custom typeface to every TextView. It happens even that the screen gets black for 2-3 seconds (appearing the app crashed), then the new Activity shows up. This doesn't happen accessing that Activity from other places in the application.
In both cases - accessing the ListActivity and accessing the GameActivity from the ListActivity - a couple of
"szipinf - Initializing inflate state"
messages appear in the LogCat. What does they mean in this context? Would it be a better usage to set the onItemClickListeners into the getView() method of my CustomAdapter? Something seems to really inhibit the transitions, but I can't figure out what, since there is nothing big to be calculated or processed (in fact, in the SQLite database are exactly two entries with each 5 fields)?
EDIT If required or desired, of course I can provide more code.