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

  • Home
  • SEARCH
  • 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 6010415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:06:46+00:00 2026-05-23T02:06:46+00:00

I am creating a chat application & for that purpose i have used TabHost.

  • 0

I am creating a chat application & for that purpose i have used TabHost.

In that first tab contains List of Buddies, and as soon as user clicks on any of the buddy

from buddy it should create another tab for that buddy in order to chat.

I am completed up to this but my problem is I am using a single Activity to perform Chat

but It always shows the same activity for each buddy.

Any Help will be highly appreciated. Here is my code,

public void onItemClick(AdapterView<?> arg0, View arg1, int position,
        long arg3) {

    RosterEntry entry = List.get(position);

    String userName = entry.getName();

    Intent intent = new Intent().setClass(RosterScreen.this,
            com.spotonsoft.chatspot.ui.ChatScreen.class);

    TabSpec tabSpec = Home.tabHost.newTabSpec("chat")
            .setIndicator(userName).setContent(intent);

    Home.tabHost.addTab(tabSpec);

}

Best Regards,

~Anup

  • 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-23T02:06:47+00:00Added an answer on May 23, 2026 at 2:06 am

    in onCreate of ChatScreen you only setup basic stuff like getting View and store it in private fields

    onResume you “recreate” ChatScreen with buddy-specific data … how to do this (pls, read comments in code)?

    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.widget.*;
    
    public class ChatScreen extends Activity {
        TextView textview = null;
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            textview = new TextView(this);
            setContentView(textview);
        }
    
        @Override
        public void onResume(){
            super.onResume();
            Intent intent = getIntent();
            if(intent!=null){
                        //we read buddy-specific data here
                textview.setText(intent.getStringExtra("chatwith"));
                        //we only setting textview with user name
                        //in real app you should store conversation somewere (fx in db)
                        //and load it here
            }   
        }
    }
    

    and your code

    Intent intent = new Intent().setClass(RosterScreen.this, com.spotonsoft.chatspot.ui.ChatScreen.class);
    // you shoud add this line and provide some information fx useName or userID to ChatScreen Activity
    intent.putExtra("chatwith", userName);
    TabSpec tabSpec = Home.tabHost.newTabSpec("chat").setIndicator(userName).setContent(intent);
    Home.tabHost.addTab(tabSpec);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 questions for you. Im creating an Application for Chat that relies
I am creating a chat application using JApplet . I have a TextArea where
I am creating chat application and in that I don't know how to create
I am creating a web chat application using asp.net vb. I have got the
I am creating some kind of chat style application. The Listbox is getting filled
I am creating a Chat application in php. AIM: when a user1 invites user2
Let's say you're creating a database to store messages for a chat room application.
I have inherited a 20-year-old interactive command-line unix application that is no longer supported
I am creating an asynchronous chat application in C. I created two threads, one
I am creating a chat application wherein I want to use smileys in the

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.