Esempio n. 1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    if (view == null) {
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      view = inflater.inflate(resource, parent, false);
    }
    ShareItem si = values.get(position);
    if (si != null) {

      ImageView imageView = (ImageView) view.findViewById(R.id.shareimage);
      TextView txtDetails = (TextView) view.findViewById(R.id.sharedescription);

      txtDetails.setText(si.getDescription());
      // icon based on bundle icons
      imageView.setImageResource(si.getShareimage());
    }
    return view;
  }
Esempio n. 2
0
  private void loadAdapter() {

    ArrayList<ShareItem> values = new ArrayList<ShareItem>();
    // Email Friend
    ShareItem sf = new ShareItem();
    sf.setShareimage(R.drawable.icon_email_to_friend);
    sf.setDescription("Email to a friend");
    values.add(sf);
    // Share on facebook
    ShareItem sface = new ShareItem();
    sface.setShareimage(R.drawable.icon_share_on_facebook);
    sface.setDescription("Share on Facebook");
    values.add(sface);
    // Share on twitter
    ShareItem st = new ShareItem();
    st.setShareimage(R.drawable.icon_share_on_twitter);
    st.setDescription("Share on Twitter");
    values.add(st);
    // Get notification
    // ShareItem not = new ShareItem();
    // not.setDescription("GET NOTIFICATIONS");
    // values.add(not);
    // Follow us on Twitter
    ShareItem stwitter = new ShareItem();
    stwitter.setShareimage(R.drawable.icon_follow_on_twitter);
    stwitter.setDescription("Follow us on Twitter");
    values.add(stwitter);
    // Like us on Facebook
    ShareItem sFacebooklike = new ShareItem();
    sFacebooklike.setShareimage(R.drawable.icon_like_on_facebook);
    sFacebooklike.setDescription("Like us on Facebook");
    values.add(sFacebooklike);

    ShareAdapter adapter = new ShareAdapter(this, R.layout.share, values);

    setListAdapter(adapter);
  }