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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:17:42+00:00 2026-05-20T16:17:42+00:00

I am developing a chat related application. I have some 4500 entries in my

  • 0

I am developing a chat related application. I have some 4500 entries in my database, this database I am getting user images and chat messages displaying. I am implemented below code file more time taken display the all information any suggestion loaded in list.

Code file:

    // Handle the messages and post messages to list view

    private void handlerMessage(final String messageType, final int dis) 
    {
         myProgressDialog = ProgressDialog.show(Shout1.this,"","Loading...",true);
         new Thread() 
         {

         public void run()
         {
             try {
                String xml;
                 Userid=getSharedPreferences("MyLoginInfo", 0).getString("user_id", "");
                if(messageType.length()==0)
                {   
                    xml="<spGetUserMessages><SearchLocation></SearchLocation><LoginUserID>"+Userid+"</LoginUserID></spGetUserMessages>";
                    messages =parse.GetGetUserMessages(dataparsing.ILGetUserMessages(xml)); 
                    Message msg = myHandler.obtainMessage();                   
                     myHandler.sendMessage(msg);
                }  
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        myProgressDialog.dismiss();
      } 
    }.start();
  }

  // Handle the messages

    private Handler myHandler = new Handler() 
    {
        public void handleMessage(Message msg) 
        {
            Log.v("Shout=====","inhandleMessage  ======="+messages.size());
            if(messages.size()==0)
            {((LinearLayout)findViewById(R.id.LinearlayoutMessage)).removeAllViews();
                Toast.makeText(Shout1.this, "No messages in that Location", Toast.LENGTH_SHORT).show();
            }
            else
            {
            ((LinearLayout)findViewById(R.id.LinearlayoutMessage)).removeAllViews();
           addElements(messages);
            }
        }

    };
    //add messagess to List
    protected void addElements(final List<MessageClass> messages2) 
    {
        ((LinearLayout)findViewById(R.id.LinearlayoutMessage)).removeAllViews();
        LinearLayout ll5=new LinearLayout(this);
        ll5.setBackgroundColor(Color.WHITE);
        ll5.setOrientation(1);

        for(int i=0;i<messages2.size();i++)
        {
                LinearLayout ll1=new LinearLayout(this);
            ll1.setPadding(0, 3, 0, 0);
            ll1.setBackgroundResource(R.drawable.tabmessage);
            ll1.setGravity(Gravity.CENTER);

            final TextView messageid = new TextView(this);
            messageid.setText(messages2.get(i).getmessageId());

            final TextView targetid = new TextView(this);
            targetid.setText(messages2.get(i).getUserid());

            final TextView targetMessage = new TextView(this);
            targetMessage.setText(messages2.get(i).getmessage());

            LinearLayout layoutmsg=new LinearLayout(this);
            layoutmsg.setClickable(true);
            layoutmsg.setOrientation(1);
            layoutmsg.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
            ImageView msgImage=new ImageView(this);
            final TextView msgimageInfo=new TextView(this);
            try
              {
                    String photoXml="<spGetMessagePhoto><MessageID>"+messages2.get(i).getmessageId()+"</MessageID></spGetMessagePhoto>";
                    String photoInfoFromDB1=new DataParsingComm().ILGetMessageImage(photoXml);
                    msgimageInfo.setText(photoInfoFromDB1);
                    if(photoInfoFromDB1.equalsIgnoreCase("anytype{}")|| photoInfoFromDB1==null)
                    {
                        msgImage.setVisibility(8);
                    }
                    else
                    {

                    byte[] imgArry= Base64.decode(photoInfoFromDB1);                    
                    Bitmap bit=BitmapFactory.decodeByteArray(imgArry,0,imgArry.length);
                    msgImage.setImageBitmap(bit);
                    }
                    }catch (Exception ee) {
                        // TODO: handle exception
                        ee.printStackTrace();
                    }

        final TextView msg=new TextView(this);
        msg.setText(messages2.get(i).getmessage());

        final TextView msg1=new TextView(this); 
        if(messages2.get(i).getmessage().length()>60)
        msg1.setText(messages2.get(i).getmessage().substring(0, 60)+"...");

        else

        msg1.setText(messages2.get(i).getmessage());
        msg1.setTextColor(Color.BLACK); 
        msg1.setTypeface(Typeface.MONOSPACE);
        msg1.setTextSize(13);
        msg1.setWidth(250);
        layoutmsg.addView(msgImage);
        layoutmsg.addView(msg1);

        ImageView PersonImage=new ImageView(this);
        final TextView imageInfo=new TextView(this);
          try{
            //get the image based on user ID
            String photoXml="<spGetUserPhoto><UserID>"+messages2.get(i).getUserid()+"</UserID></spGetUserPhoto>";
            Log.v("check","photoXml.."+photoXml);   
            String photoInfoFromDB=new DataParsingComm().ILGetImage(photoXml);
            Log.v("photoInfoFromDB","photoInfoFromDB.."+photoInfoFromDB);
            imageInfo.setText(photoInfoFromDB);
            if(photoInfoFromDB.equalsIgnoreCase("anytype{}")||photoInfoFromDB.equals(null) )
            {
              PersonImage.setImageResource(R.drawable.person);
            }
            else
            {
            byte[] imgArry= Base64.decode(photoInfoFromDB);
            Bitmap bit=BitmapFactory.decodeByteArray(imgArry,0,imgArry.length);
            Log.v("Shout","Image Lengthhhhhhhhhhhhh"+imgArry.length);
            PersonImage.setImageBitmap(bit);
            }
            }catch (Exception ee) {
                ee.printStackTrace();
            }

        final TextView personName=new TextView(this);
        if(messages2.get(i).getUname().equalsIgnoreCase("noname"))
            personName.setText("");
        else                
        personName.setText(messages2.get(i).getUname());
        personName.setTextColor(Color.rgb(0, 102, 51));
        LinearLayout layoutPersonImage=new LinearLayout(this);
        layoutPersonImage.setOrientation(1);
        layoutPersonImage.setGravity(Gravity.CENTER);
        layoutPersonImage.addView(PersonImage); 
        layoutPersonImage.addView(personName); 
        ll1.addView(layoutPersonImage);
        ll1.addView(layoutmsg);
                ll5.addView(ll1);
        }
        ((LinearLayout)findViewById(R.id.LinearlayoutMessage)).addView(ll5);
        }
  • 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-20T16:17:42+00:00Added an answer on May 20, 2026 at 4:17 pm

    You can store the image in Cache memory and access it. Check out this sample:

    Images in cache Memory

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

Sidebar

Related Questions

I'm developing a chat application. For getting frequetly comming request,messages and zone request I'm
i am developing chat related similar application i am using backgrouund synchronous class some
Hi all i am developing a chat application ... i have multiple chat windows
I am developing an application in asp.net mvc where i need to have Chat
I am developing a chat application. And i want to have pop up window
I m developing an Android chat application where in user will be provided with
I am developing a chat application.Here for chat i have used ListView . I
i am developing chat application in android... i got some exception when i run
I'm developing a small chat application between client and server. I would like to
I am developing Android Application for Chat between two users as private session .

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.