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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:21:31+00:00 2026-05-29T21:21:31+00:00

I have a customized BaseAdapter for my listView with this code: public View getView(int

  • 0

I have a customized BaseAdapter for my listView with this code:

public View getView(int position, View convertView, ViewGroup parent) {
  ViewHolder holder;
  if (convertView == null) 
  { 
  } 
  else 
  {
   holder = (ViewHolder) convertView.getTag();
  }
  convertView = mInflater.inflate(R.layout.user_submissions_customisation, null);
   holder = new ViewHolder();
   holder.JournalName = (TextView) convertView.findViewById(R.id.JournalName);
   holder.SubmissionTitle = (TextView) convertView.findViewById(R.id.SubmissionTitle);
   holder.SubmissionDate = (TextView) convertView.findViewById(R.id.SubmissionDate);
   holder.statusOk=(ImageView)convertView.findViewById(R.id.statusOkImage);
   holder.statusRejected=(ImageView)convertView.findViewById(R.id.statusRejectedImage);
   holder.statusProcessing=(ImageView)convertView.findViewById(R.id.statusProcessingImage);
   convertView.setTag(holder);

  ImageView statusOk=(ImageView)convertView.findViewById(R.id.statusOkImage);
  ImageView statusRejected=(ImageView)convertView.findViewById(R.id.statusRejectedImage);
  ImageView statusProcessing=(ImageView)convertView.findViewById(R.id.statusProcessingImage);

  MDPIActivity mdpi = new MDPIActivity();
  Context context =mdpi.getContext();
  LocalDatabase localDatabase = new LocalDatabase(context); //Instantiation of the DB
  int status = localDatabase.getSubmissionStatus(position+1);

  if (status==102 | status==19)
  {
      statusRejected.setVisibility(View.VISIBLE);
  }
  else
  {
      if (status==29)
      {
      statusOk.setVisibility(View.VISIBLE);
      }
      else
      {
          statusProcessing.setVisibility(View.VISIBLE);
      }
  }

  holder.JournalName.setText(submissionsArrayList.get(position).getJournalTitle()+"-"+submissionsArrayList.get(position).getID());
  holder.SubmissionTitle.setText(submissionsArrayList.get(position).getTitle());
  holder.SubmissionDate.setText(submissionsArrayList.get(position).getDate());

  return convertView;
}

 static class ViewHolder {
  TextView JournalName;
  TextView SubmissionTitle;
  TextView SubmissionDate;
  ImageView statusOk;
  ImageView statusRejected;
  ImageView statusProcessing;
 }

All works wel but the creation of the list on the display and the scrolling is pretty slow.
I used this for éy list too:

android:fastScrollEnabled="true"
android:scrollingCache="true"
android:smoothScrollbar="true"

But the view changing from the previeous view to the listview is slow and the scrolling of the list too.

  • 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-29T21:21:33+00:00Added an answer on May 29, 2026 at 9:21 pm

    All apart first do this thing
    Move this code in the if condition when “convert view is null”

    convertView = mInflater.inflate(R.layout.user_submissions_customisation, null);
    holder = new ViewHolder();
    holder.JournalName = (TextView) convertView.findViewById(R.id.JournalName);
    holder.SubmissionTitle = (TextView) convertView.findViewById(R.id.SubmissionTitle);
    holder.SubmissionDate = (TextView) convertView.findViewById(R.id.SubmissionDate);
    holder.statusOk=(ImageView)convertView.findViewById(R.id.statusOkImage);
    holder.statusRejected=(ImageView)convertView.findViewById(R.id.statusRejectedImage);
    holder.statusProcessing=(ImageView)convertView.findViewById(R.id.statusProcessingImage);
    convertView.setTag(holder);

    You are not using the adapter efficiently by coding as you did.
    The above way will improve the performance for sure.

    In nutshell, you must inflate the view for list row only when the convert view is null.
    Also, different views in the row’s view must be initialized with the convertView itself.
    Then you set holder view as the tag to the convert view and the adapter will continuously provide the same view instead of inflating the new one every time.

    Edit:You should move the code for getting the context and instantiating the db from the getView() method.
    Just make a class level variable “mContext” in your adapter class and instantiate it in the constructor of your adapter by passing activity’s context.
    Then at same place (constructor) instantiate the db also.

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

Sidebar

Related Questions

I have a ListView that uses a customized adapter, but I can't click on
I have customized the camera with custom buttons(UIButton) by overlay view. My iPhone application
I'm using the standard Apple moviePlayer sample code and have customized it to play
I have customized UITableViewCell (Static Content Loaded from nib). This cell contains one UILable
I have one customized list MyList that extends ArrayList, like this: class MyList extends
I have the below jquery code I have customized it as per my requirement
I came across this application, that appeared to have customized the UI Picker. I
I have a customized ListView that each row of the list is composed by
I have customized a canvas to support the zooming. I am doing this by
I have a customized EditText, which need to do customized paste. I overrode onTextContextMenuItem(int

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.