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 9189865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:19:49+00:00 2026-06-17T20:19:49+00:00

I am using the base adapter , i have list which contains list with

  • 0

I am using the base adapter , i have list which contains list with the text view (means left side sent items and below to that ,right side received items, i want to click on the each position in the list to perform replying the messaging .

Please suggest me how do i perform the function on clicking the listitem

Below is the code ,which i am using

class MessageAdapter extends BaseAdapter {

     ViewHolder viewHolder;
     LayoutInflater inflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);

     public int getCount() {
            // TODO Auto-generated method stub
            return Constant_Variables.Sms_Status_list.size();
        }

     public Object getItem(int position) {
            // TODO Auto-generated method stub
            return position;
        }

     @Override
     public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        }



     @Override
     public View getView(final int position, View convertView, ViewGroup parent) {

         if (convertView == null) {
             convertView = inflater.inflate(R.layout.messagelist_row, null);

             viewHolder=new ViewHolder();

             viewHolder.sms_from_row=(TextView)convertView.findViewById(R.id.sms_from_txtview);
             viewHolder.sms_to_row=(TextView)convertView.findViewById(R.id.sms_sendto_txtview);

         }
         else
         {
             viewHolder = (ViewHolder) convertView.getTag();
         }


         viewHolder.sms_from_row.setVisibility(View.VISIBLE);
         viewHolder.sms_to_row.setVisibility(View.VISIBLE);


         if(Constant_Variables.Sms_Status_list.get(position).equalsIgnoreCase(Twilioresponse_Utils.sms_sent))
         {
             viewHolder.sms_from_row.setVisibility(View.GONE);
             viewHolder.sms_to_row.setText("Sent: "+Constant_Variables.Sms_from_list.get(position));

         }
         else if(Constant_Variables.Sms_Status_list.get(position).equalsIgnoreCase(Twilioresponse_Utils.sms_received))
         {
             viewHolder.sms_to_row.setVisibility(View.GONE);
             viewHolder.sms_from_row.setText("Received: "+Constant_Variables.Sms_to_list.get(position));
         }
         else
         {
             viewHolder.sms_from_row.setText("Message in queued.");
             viewHolder.sms_to_row.setVisibility(View.VISIBLE);
         }


         convertView.setTag(viewHolder);


         return convertView;
     }

     protected void onListItemClick(ListView l, View v, final int position, long id) {

         if(l.callOnClick()== true)
         {
             Log.i("the Item clicked is at position : ", ""+ position);
         }

         else
         {
             Log.i("the Item not clicked is at position : ","the Item not clicked is at position" );
         }
     }
 }

Below is the XML code which i am using

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >

    <TextView
        android:id="@+id/sms_from_txtview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="12dp"
        android:layout_alignParentRight="true"
        android:background="@drawable/blue"
        android:layout_alignParentTop="true"
        android:text="From" />

    <TextView
        android:id="@+id/sms_sendto_txtview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="12dp"
        android:background="@drawable/red"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="To" />
</RelativeLayout >

Regards
Amrinder Singh

  • 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-17T20:19:51+00:00Added an answer on June 17, 2026 at 8:19 pm

    there is onItemClickListener in android, you can use that

    ListView listview = (ListView)findViewById(R.id.yourlist);
    listview.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // @todo
        }
    });
    

    For individual view in you list item, you can always add click listener in getView method.

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

Sidebar

Related Questions

We have created custom listview by using the Base adapter. List view contains Text
I have created a custom Base Adapter class, to populate a list view with
I have implemented an application with Custom base adapter for display data in list
I have used a custom array adapter to populate my list view.The problem i
I have a list view whose adapter is in a different class in a
I have a simple layout file which displays the icons and some text view
I have add buttons in GridView using base adapter, that buttons depend on word
Im using a BaseAdapter and passing to it a List of objects that have
I have a small code base using Subsonic 2.1 in my project. I would
In CodeIgniter I'm using a base CRUD My_model , but I have this small

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.