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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:42:11+00:00 2026-05-31T22:42:11+00:00

I am able to send and receive message xmpp client and display them in

  • 0

I am able to send and receive message xmpp client and display them in listview in corresponding layouts. When i send or receive message. I get both the sent and received message combined in a single textview on different layouts.I need to display them in different layouts’s textview. i want to display received message in 1 layout’s textview and sent message in another layouts textview correspondingly.

Kindly guide me in this issue..

Thanks in advance.

  • 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-05-31T22:42:12+00:00Added an answer on May 31, 2026 at 10:42 pm

    You can Perform this below way:-

    package com.aman.sample.bubblelist;
    
    import android.app.Activity;
    import android.content.SharedPreferences;
    import android.graphics.drawable.Drawable;
    import android.os.Bundle;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.ImageView;
    import android.widget.ListView;
    import android.widget.TextView;
    
    public class Main extends Activity {
    
        String[] data = { "Sample User Data ", "Sample User Data ",
                "Sample User Data ", "Sample User Data ", "Sample User Data ",
                "Sample User Data ", "Sample User Data ", "Sample User Data ",
                "Sample User Data ", "Sample User Data ", "Sample User Data ",
                "Sample User Data ", "Sample User Data ", "Sample User Data ",
                "Sample User Data ", "Sample User Data " };
        Drawable[] usrimg = null;
        String bgimg = "", _user = "", _pass = "";
        int odd_resID, even_resID;
        ListView myList;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            // finding the list view
            myList = (ListView) findViewById(R.id.myList);
            myList.setAdapter(new MyCustomAdapter());
            myList.setCacheColorHint(0);
    
        }
    
        class MyCustomAdapter extends BaseAdapter {
    
            @Override
            public int getCount() {
                return data.length;
            }
    
            @Override
            public String getItem(int position) {
                // TODO Auto-generated method stub
                return null;
            }
    
            @Override
            public long getItemId(int position) {
                // TODO Auto-generated method stub
                return position;
            }
    
            @Override
            public int getItemViewType(int position) {
                // TODO Auto-generated method stub
                return position;
            }
    
            @Override
            public int getViewTypeCount() {
                // TODO Auto-generated method stub
                return data.length;
            }
    
            public View getView(int position, View convertView, ViewGroup parent) {
                LayoutInflater inflater = getLayoutInflater();
                View row;
                int _intPosition = getItemViewType(position);
                String even_color, odd_color;
                SharedPreferences prefList = getSharedPreferences("PrefsFile",
                        MODE_PRIVATE);
                ;
                even_color = prefList.getString("even_bubble_color", "pink");
                odd_color = prefList.getString("odd_bubble_color", "green");
                int even_color_id = getResources().getIdentifier(even_color,
                        "drawable", "com.teks.chilltwit"), odd_color_id = getResources()
                        .getIdentifier(odd_color, "drawable", "com.teks.chilltwit");
                ImageView even_view, odd_view;
    
                if (_intPosition % 2 == 0) {
                    row = inflater.inflate(R.layout.list_row_layout_even, parent,
                            false);
                    TextView textLabel = (TextView) row.findViewById(R.id.text);
    
                    textLabel.setText(data[position]);
    
                } else {
                    row = inflater.inflate(R.layout.list_row_layout_odd, parent,
                            false);
                    TextView textLabel = (TextView) row.findViewById(R.id.text);
    
                    textLabel.setText(data[position]);
                }
    
                return (row);
            }
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to send out a UDP message and also receive
I'm currently working on an asynchronous TCP-Client. I am able to send and receive
I need to be able to send a string message and receive a string
What would be the easiest way to be able to send and receive raw
I had an idea that would require me be able to send and receive
I did my own Socket class, to be able to send and receive HTTP
I have a client that wants the application to be able to send SMS
I am trying to write an xmpp client to send/recieve messages from gtalk. Before
I'm trying to send and receive a client-event using a GtkWidget on the win32
i am working on a chat application. I am able to send and receive

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.