I am using a list view and creating a custom adapter. I am trying to get information every time the button is clicked. The button being declared is connected with each item in the list view. How can I use that button variable so that I get the actual button being used and not just the first button of the list.

Here is the adapter method:

Java Code:
class PostsAdapter extends ArrayAdapter<Posts>{

        //used to create views from xml
        private LayoutInflater layoutInflater;

        public PostsAdapter(Context context, int textViewResourceId, List<Posts> posts) {
            super(context, textViewResourceId, posts);
            layoutInflater = LayoutInflater.from(context);
        }

        //add to xml from dataset
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = layoutInflater.inflate(R.layout.activity_posts, null);
            Posts posts = getItem(position);

            TextView content = (TextView) view.findViewById(R.id.content);
            TextView user = (TextView) view.findViewById(R.id.user);
            TextView topic = (TextView) view.findViewById(R.id.topic);
            TextView date = (TextView) view.findViewById(R.id.date);
            TextView likes = (TextView) view.findViewById(R.id.likeCount);
            TextView id = (TextView) view.findViewById(R.id.hiddenID);

            Button like = (Button) view.findViewById(R.id.btnLike);

            content.setText(posts.getContent());
            user.setText(posts.getUser());
            topic.setText(posts.getTopic());
            date.setText(posts.getDate());
            likes.setText(posts.getLikes());
            id.setText(posts.getId());

            like.setOnClickListener(DisplayPosts.this);

            return view;
        }
In my other method I have to redeclare my button variable and this just gets the first button in the list, not the one being clicked on:

Java Code:
private void createLike(){
        Button like = (Button) findViewById(R.id.btnLike);
        TextView id = (TextView) findViewById(R.id.hiddenID);
        TextView user = (TextView) findViewById(R.id.user);

        final String hid = id.getText().toString().trim();
        final String puser = user.getText().toString().trim();

        if(like.getText().toString().equalsIgnoreCase("like")){
            like.setText("UnLike");
           ...