Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //***IMAGE ADAPTER CLASS***
- public class ImageAdapter extends BaseAdapter
- {
- Context MyContext;
- public ImageAdapter(Context _MyContext)
- {
- MyContext = _MyContext;
- }
- @Override
- public int getCount()
- {
- return currentTitlesList.size();
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent)
- {
- View MyView;
- if ( convertView == null )
- {
- LayoutInflater li = getLayoutInflater();
- MyView = li.inflate(R.layout.grid_item, null);
- }
- else
- {
- MyView = convertView;
- }
- try
- {
- iv = (ImageView) MyView.findViewById(R.id.grid_item_image);
- iv.setImageBitmap(currentPhotosList.get(position)); //set tile image
- gridText = (TextView)MyView.findViewById(R.id.grid_item_text);
- gridText.setText(" " + currentTitlesList.get(position) + " "); //set tile text
- }
- catch (Exception e)
- {
- Toast.makeText(getApplicationContext(), R.string.tileObjectError, Toast.LENGTH_LONG).show();
- }
- return MyView;
- }
- @Override
- public Object getItem(int arg0)
- {
- // TODO Auto-generated method stub
- return null;
- }
- @Override
- public long getItemId(int arg0)
- {
- // TODO Auto-generated method stub
- return 0;
- }
- }
Add Comment
Please, Sign In to add comment