Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8607845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:27:43+00:00 2026-06-12T03:27:43+00:00

I want to send to adapter only one item from my custom ArrayList. When

  • 0

I want to send to adapter only one item from my custom ArrayList. When Activity starts, I send only one item. Then I want to implement gestureListener to my Activity and if I detect swipe up or down Action, I send to the adapter another item. How can I implement this?

I have my custom ArrayAdapter, where I pass my List. But I want to sent only one item:

public class InteractionsAdapter extends  ArrayAdapter<Message>{

  Context context; 
int layoutResourceId;    
List<Message> messages = null;
private Activity activity;
public InteractionsAdapter(Context context,  int layoutResourceId,List<Message> messages) {
    super(context, layoutResourceId, messages);
    this.layoutResourceId = layoutResourceId;
    this.context = context;
    this.messages = messages;
}

public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    InteractionHolder holder = null;

    if(row == null)
    {

        (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        LayoutInflater inflater = (LayoutInflater)this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.interactions_item, parent, false);

        holder = new InteractionHolder();
        holder.interactionId= (TextView)row.findViewById(R.id.interactionId);
        holder.interactionAbove = (TextView)row.findViewById(R.id.interactionAbove);
        holder.interactionBelow = (TextView)row.findViewById(R.id.interactionBelow);
        holder.interactionMessage = (TextView)row.findViewById(R.id.interactionMessage);
        holder.interactionDate = (TextView)row.findViewById(R.id.interactionDate);

        row.setTag(holder);
    }
    else
    {
        holder = (InteractionHolder)row.getTag();
    }

    Message message = messages.get(position);
    Log.i("in doinbackground",Integer.toString(messages.size()));

        Log.i("position",Integer.toString(position));

        holder.interactionId.setText(Integer.toString(message.getMessageId()));
        holder.interactionAbove.setText(Integer.toString(position));
        holder.interactionBelow.setText(Integer.toString(messages.size()-position-1));
        holder.interactionMessage.setText(message.getMessageBody());
        holder.interactionDate.setText(message.getMessageDate().toString());

    return row;
}

static class InteractionHolder
{
    TextView interactionId;
    TextView interactionDate;
    TextView interactionAbove;
    TextView interactionBelow;
    TextView interactionMessage;

}

}

I tried to do it with ArrayAdapter, passing only one item, but it doesn’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:27:44+00:00Added an answer on June 12, 2026 at 3:27 am

    I solved my problem, simply adding an

    @Override
    public int getCount() {
        return 1;
    }
    

    and it works properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application i want send a email to one account.in one button click
Want to send the text from my current vb application to the Active Window
I want to send a large blob from biztalk with some metadata to a
if i want send email with SwiftMailer in symfony then i must in action:
I want send a direct message to one of my follower of twitter through
I want send an image from my App to web service, to do it,
we have a legacy middleware application and we want to implement WCF Adapter for
I have an adapter where I load my users and one button/textfiled for send
I Want Send A File From A Computer To Other Computer With UDP protocol.How
I want send e-mail with some images in content. I think I must attached

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.