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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:41:18+00:00 2026-05-25T12:41:18+00:00

In MainAcitivty.java i populate an Arraylist with items. I need these items in my

  • 0

In MainAcitivty.java i populate an Arraylist with items. I need these items in my customadapter class because i need them to set the colour of certain rows in a textview.

I have a dynamic array: storage [], whose size is set during the process:

 storage = new int[db];

This array has the following items e.g.: 35,56,67

The arraylist “myArr3” has the same items but type of the elements are string.

This is the definition of the myArr3 arraylist:

  ArrayList<String> myArr3 = new ArrayList<String>();

I am looking for a solution to manages these items in the other class whether it is an integer type array or a string type arraylist.

In MyCustomBaseAdapter2.java i set the layout of the Adapter:

package com.bfarago.nevnap;

import java.util.ArrayList;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.Toast;

public class MyCustomBaseAdapter2 extends BaseAdapter {
     private static ArrayList<SearchResults> searchArrayList;

 private LayoutInflater mInflater;

 public MyCustomBaseAdapter2(Context context, ArrayList<SearchResults> results) {
  searchArrayList = results;
  mInflater = LayoutInflater.from(context);
 }

public MyCustomBaseAdapter2(OnClickListener onClickListener,
        ArrayList<SearchResults> searchResults) {
    // TODO Auto-generated constructor stub
}

public int getCount() {
  return searchArrayList.size();
 }

 public Object getItem(int position) {
  return searchArrayList.get(position);
 }

 public long getItemId(int position) {
  return position;
 }

 public View getView(int position, View convertView, ViewGroup parent) {
  ViewHolder holder;
  if (convertView == null) {
   convertView = mInflater.inflate(R.layout.row2, null);
   holder = new ViewHolder();


       holder.txtName = (TextView) convertView.findViewById(R.id.left);
       holder.txtCityState = (TextView) convertView.findViewById(R.id.right);


   convertView.setTag(holder);
  } else {
   holder = (ViewHolder) convertView.getTag();
  }

  holder.txtName.setText(searchArrayList.get(position).getName());
  holder.txtCityState.setText(searchArrayList.get(position).getCityState());



  return convertView;
 }

static class ViewHolder {
  TextView txtName;
  TextView txtCityState;

 }
}
  • 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-25T12:41:18+00:00Added an answer on May 25, 2026 at 12:41 pm

    The solution is to use intents to pass an array from one activity to another activity.

    The answer can be found in this

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

Sidebar

Related Questions

findViewById returns null for EditText Java Code: public class MainActivity extends Activity { private
How to set setLayoutParams() for LinearLayout elements. in MainActivity.java . I wrote the following
I have developed some reusable android component which is basically a class . This
Have following setup: MainActivity class - extends activity MyLayout class - extends View Prefs
This is my code: public class MainActivity extends Activity { private ComponentName mService; private
I need font typeface Helvetica in my application and works for all activities.there are
I'm totally new to Android (Java) Development and I'm so excited about it! The
I have CameraList class that provides Cameras list like SONY,VIVOTEK,VIVOTEK 7XXX,PIXORD,TOSHIBA,JVC E-CON... And I
I get this error !! Class Not found .. please check the following error
In my main activity I am having a method that I need to call

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.