1

I have a ListView inside each item I have a facebook share button

<com.facebook.share.widget.ShareButton
    android:id="@+id/btnOne"
    android:layout_centerInParent="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="5dp" />

But when I click on the button MediaAdapter.java inside public View getView(final int position, View convertView, ViewGroup parent)

holder.button = (Button) v.findViewById(R.id.btnOne);
holder.button.setOnClickListener(new View.OnClickListener() { 
    @Override 
    public void onClick(View v) {
        v.setTag(holder);        
        Drawable mDrawable =  holder.imageview.getDrawable();
        Bitmap image = ((BitmapDrawable)mDrawable).getBitmap();

        SharePhoto photo = new SharePhoto.Builder()
                        .setBitmap(image)
                        //.setCaption("Give me my codez or I will ... you know, do that thing you don't like!")
                         .build();

        SharePhotoContent content = new SharePhotoContent.Builder()
                         .addPhoto(photo)
                         .build();

        ShareApi.share(content, null);  

    }   

});

I get this error:

enter image description here

Allan Pereira
  • 2,572
  • 4
  • 21
  • 28
hinata
  • 23
  • 6
  • cast to ShareButton not Button in holder.button = (Button) v.findViewById(R.id.btnOne); – Pavya May 02 '16 at 05:19
  • thank you but the problem still exists after the cast " holder.button = (ShareButton) v.findViewById(R.id.btnOne); " – hinata May 02 '16 at 14:34

0 Answers0