To create a custom font in mine ListActivity, I wrote a class CustomAdapterextending BaseAdapteraccording to this example here .
However, as described there, I wrote a method getView()as shown below:
public View getView(int position, View convertView, ViewGroup parent){
String gameName = gameNames[position];
TextView tv = new TextView(context);
tv.setText(gameName);
tv.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/gulim.ttf"));
return tv;
}
It works as intended. The only thing that bothers is that it takes about three or four seconds until a list appears (and this is a very long time in this context). However, in ListActivityI installed onItemClickListeneras follows:
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();
}
, ListItem, , GameActivity. Activity TextView, , SQLite. TextView. , 2-3 ( ), Activity. Activity .
- ListActivity GameActivity ListActivity -
"szipinf - "
LogCat. ? onItemClickListener getView() CustomAdapter? , - , , , , ( , SQLite 5 )?
, , .