Please note, this is really weird.
For some reason, the method setChoiceMode (ListView.CHOICE_MODE_SINGLE) no results.
I use it like this:
list = (ListView) findViewById(R.id.list);
list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
list.setOnItemClickListener(OnItemClickListenerObject);
list.setAdapter(adapter);
The fact is that after I put the method setChoiceMode (), nothing has changed, RadioButtons not appeared.
I'm using a custom adapter and I have no problems with it? But I do not understand why Radiobuttons not shown.
Any ideas? (If you need additional code, ask and I'll post it.)
My adapter code:
public class ContactAdapter extends BaseAdapter {
private LayoutInflater inflater;
private ArrayList<Contact> contacts;
private View view;
public ContactAdapter(Context context, ArrayList<Contact> contacts) {
this.contacts = contacts;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
return contacts.size();
}
#Override
public Object getItem(int position) {
return contacts.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
private Contact getContact(int position) {
return (Contact) getItem(position);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
view = convertView;
if (view == null) {
view = inflater.inflate(R.layout.contact_item, parent, false);
}
Contact c = getContact(position);
((TextView) view.findViewById(R.id.lv_name)).setText(c.getName() + " " + c.getSurname());
((ImageView) view.findViewById(R.id.lv_img)).setImageBitmap(c.getPhoto());
return view;
}
}
Below shows the layout that I use for ListView item.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="8dp">
<ImageView
android:id="#+id/lv_img"
android:layout_width="75dp"
android:layout_height="75dp"
android:src="#drawable/default_user"
android:layout_weight="0"/>
<TextView
android:id="#+id/lv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="16dp"
android:layout_gravity="center_vertical"
android:textSize="24sp"/>
</LinearLayout>
Setting the choice mode does not automatically make radio buttons appear. All it does is add behavior which toggles a ListView row's Checkable or activation state. It's still up to the row's View to decide how to react to that. You'll need to create your own layout to inflate for a row that supports the activation state or the Checkable interface.
Android does provide some simple pre-made views that you can use. Here's just a couple you can choose from:
android.R.layout.simple_list_item_activated_1.xml
android.R.layout.simple_list_item_checked.xml
Related
I implement custom listview containing a checked textview. My wish is to change the state of the checkbox on click, but it seems not to be simple, as I thought it would be. Additionally I would like to check the checkboxes of items, that are stored in database, how could it be done? At the moment I have an activity which shows the elements, handles the click on the checkbox (not the list item!), but canĀ“t change the checkbox status by items stored in database.
This is my custom list item:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<CheckedTextView
android:id="#+id/name"
android:layout_width="409dp"
android:layout_height="30dp"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:paddingStart="5dp"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/type"
android:layout_width="409dp"
android:layout_height="34dp"
android:paddingStart="5dp"
android:textSize="18sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/name" />
</androidx.constraintlayout.widget.ConstraintLayout>
This is my adapter:
public class CustomAdapter extends BaseAdapter
{
private List<CustomElement> elems;
private LayoutInflater inflater;
public HueBulbAdapter(Context ctx, List<CustomElement> elems)
{
this.elems = elems;
inflater = LayoutInflater.from(ctx);
}
#Override
public int getCount()
{
return elems.size();
}
#Override
public Object getItem(int position)
{
return null;
}
#Override
public long getItemId(int position)
{
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent)
{
ConstraintLayout result = (ConstraintLayout) inflater.inflate(R.layout.custom_elems, parent, false);
CheckedTextView name = result.findViewById(R.id.name);
TextView type = result.findViewById(R.id.type);
CustomElement elem = elems.get(position);
name.setText(elem.getName());
type.setText(elem.getType());
result.setTag(position);
toggle(name);
return result;
}
private void toggle(CheckedTextView ctv) {
ctv.setOnClickListener(v -> {
ctv.setChecked(!ctv.isChecked());
});
}
}
And this is my activity:
[...]
elemsView.setOnItemClickListener((parent, view, position, id) ->
{
if (!selected.containsKey(elemList.get(position).getName()))
{
selected.put(elemList.get(position).getName(), elemList.get(position));
} else
{
selected.remove(elemList.get(position).getName());
}
});
[...]
Maybe I am using wrong components to reach my target? Any Ideas how to do it this way or in a better way?
Thanks for your help!
Few suggestions:
Add a boolean variable to the CustomElement model to track if item is checked or not checked.
Add private boolean isChecked; and generate getter and setter for it.
In adapter class, use public Object getItem(int position) to return item in list, and not null.
Change to return elems.get(position);
In adapter class, replace toggle(name) with:
name.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
elem.setChecked(!elem.isChecked()); // toggle
name.setChecked(elem.isChecked());
}
});
In your activity class, to access the updated list, use this:
for (int i = 0; i < mAdapter.getCount(); i++) {
CustomElement element = (CustomElement) mAdapter.getItem(i);
if (element.isChecked()) {...} else {...}
}
Optional. Search and implement ViewHolder Pattern in adapter class to improve the loading speed of ListView items.
I am new to android programming and this task is really need for my school project. Please kindly help me.
I've string array List - (retrieved from csv)
list = new ArrayList<>(Arrays.asList("111,222,333,444,555,666".split(",")));
myList.setAdapter(new ArrayAdapter<String>(getActivity(),R.layout.cell,list));
The result is showing only line by line text of arrayList. I want to add button to each generated line by line to delete clicked row.
Please how can I do this. Thank you for understanding my problem.
You have to create a custom layout xml which having a single item then you will add your button to this layout along with any other items.
CustomLayout.Xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/tvContact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textStyle="bold" />
<Button
android:id="#+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call" />
</RelativeLayout>
Now after creating custom item layout you need listview which holds all items.
MainActivity.xml
.
.
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
.
.
Now in java file just set adapter with our custom layout xml
.
.
list = new ArrayList<String>(Arrays.asList("111,222,333,444,555,666".split(",")));
listview.setAdapter(new MyCustomAdapter(list, context) );
.
.
Custom adapter Class
public class MyCustomAdapter extends BaseAdapter implements ListAdapter {
private ArrayList<String> list = new ArrayList<String>();
private Context context;
public MyCustomAdapter(ArrayList<String> list, Context context) {
this.list = list;
this.context = context;
}
#Override
public int getCount() {
return list.size();
}
#Override
public Object getItem(int pos) {
return list.get(pos);
}
#Override
public long getItemId(int pos) {
return list.get(pos).getId();
//just return 0 if your list items do not have an Id variable.
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.CustomLayout, null);
}
//Handle TextView and display string from your list
TextView tvContact= (TextView)view.findViewById(R.id.tvContact);
tvContact.setText(list.get(position));
//Handle buttons and add onClickListeners
Button callbtn= (Button)view.findViewById(R.id.btn);
callbtn.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View v) {
//do something
}
});
addBtn.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View v) {
//do something
notifyDataSetChanged();
.
}
});
return view;
}
}
We have need ListviewActivity for listing your data
SchoolAdapter which is custom adapter to inflate each individual row
activity_listview which is layout for ListviewActivity
view_listview_row which is required for each individual row
Now create all file as below
For ListviewActivity,
public class ListviewActivity extends AppCompatActivity {
private ListView mListview;
private ArrayList<String> mArrData;
private SchoolAdapter mAdapter;
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listview);
mListview = (ListView) findViewById(R.id.listSchool);
// Set some data to array list
mArrData = new ArrayList<String>(Arrays.asList("111,222,333,444,555,666".split(",")));
// Initialize adapter and set adapter to list view
mAdapter = new SchoolAdapter(ListviewActivity.this, mArrData);
mListview.setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();
}
For SchoolAdapter,
public class SchoolAdapter extends BaseAdapter {
private Context mContext;
private ArrayList<String> mArrSchoolData;
public SchoolAdapter(Context context, ArrayList arrSchoolData) {
super();
mContext = context;
mArrSchoolData = arrSchoolData;
}
public int getCount() {
// return the number of records
return mArrSchoolData.size();
}
// getView method is called for each item of ListView
public View getView(int position, View view, ViewGroup parent) {
// inflate the layout for each item of listView
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.view_listview_row, parent, false);
// get the reference of textView and button
TextView txtSchoolTitle = (TextView) view.findViewById(R.id.txtSchoolTitle);
Button btnAction = (Button) view.findViewById(R.id.btnAction);
// Set the title and button name
txtSchoolTitle.setText(mArrSchoolData.get(position));
btnAction.setText("Action " + position);
// Click listener of button
btnAction.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
// Logic goes here
}
});
return view;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}}
For activity_listview,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#D1FFFF"
android:orientation="vertical">
<ListView
android:id="#+id/listSchool"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="#0000CC"
android:dividerHeight="0.1dp"></ListView>
For view_listview_row,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="7.5dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="7.5dp">
<TextView
android:id="#+id/txtSchoolTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:text="TextView"
android:textColor="#android:color/black"
android:textSize="20dp" />
<Button
android:id="#+id/btnAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Click Me" />
At last but not least, do not forgot to add your activity in manifest.xml
Create a custom list view in another file with the only content of each item in the list.
Then create a Custom Adapter extending BaseAdapter and bind it.
Please refer to this website for example.
https://looksok.wordpress.com/tag/listview-item-with-button/
OR
http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/
I've read various SO threads on the topic but none of them seem to apply to my code.
I'm trying to populate a fragment with a ListView with my custom NearbyAdapter. However, my getView() method never gets called (as demonstrated by my logs not showing up). The view itself seems to be appropriately attached to my fragment, as demonstrated by the button in the view showing up, but not the ListView.
Relevant NearbyListFragment.java code:
public class NearbyListFragment extends ListFragment {
private int mImageSize;
private boolean mItemClicked;
private NearbyAdapter mAdapter;
private List<Place> places;
private LatLng mLatestLocation;
private static final String TAG = "NearbyListFragment";
public NearbyListFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d(TAG, "NearbyListFragment created");
View view = inflater.inflate(R.layout.fragment_nearby, container, false);
return view;
}
//TODO: Do asynchronously?
#Override
public void onViewCreated(View view, Bundle savedInstanceState) {
//Load from data source (NearbyPlaces.java)
mLatestLocation = ((NearbyActivity) getActivity()).getmLatestLocation();
//FIXME: Hardcoding mLatestLocation to Michigan for testing
//mLatestLocation = new LatLng(44.182205, -84.506836);
places = loadAttractionsFromLocation(mLatestLocation);
mAdapter = new NearbyAdapter(getActivity(), places);
ListView listview = (ListView) view.findViewById(R.id.listview);
//setListAdapter(mAdapter);
listview.setAdapter(mAdapter);
Log.d(TAG, "Adapter set to ListView");
mAdapter.notifyDataSetChanged();
}
private class NearbyAdapter extends ArrayAdapter {
public List<Place> placesList;
private Context mContext;
public NearbyAdapter(Context context, List<Place> places) {
super(context, R.layout.item_place);
mContext = context;
placesList = places;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// Get the data item for this position
Place place = (Place) getItem(position);
//FIXME: This never gets called
Log.d(TAG, "Place " + place.name);
// Check if an existing view is being reused, otherwise inflate the view
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_place, parent, false);
}
// Lookup view for data population
TextView tvName = (TextView) convertView.findViewById(R.id.tvName);
TextView tvDesc = (TextView) convertView.findViewById(R.id.tvDesc);
// Populate the data into the template view using the data object
tvName.setText(place.name);
tvDesc.setText(place.description);
// Return the completed view to render on screen
return convertView;
}
#Override
public long getItemId(int position) {
return position;
}
The layout file of the fragment, fragment_nearby.xml :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/btn_New">
</ListView>
<Button
android:id="#+id/btn_New"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginBottom="20dp"
android:text="Button"
android:width="170dp"
android:layout_alignParentBottom="true" />
</RelativeLayout>
And the layout file of the item, item_place.xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name" />
<TextView
android:id="#+id/tvDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Desc" />
</LinearLayout>
Edit: Does anyone want to actually include a reason for the downvote? Especially when something like Custom Adapter for List View has 129 upvotes?
The issue is that ArrayAdapter does not know about List places:
Use this to fix it:
private static class NearbyAdapter extends ArrayAdapter<Place> {
public NearbyAdapter(Context context, List<Place> places) {
super(context, R.layout.item_place, places);
mContext = context;
placesList = places;
}
}
P/s: in this case, I think you need more control to set your place data to your view. Consider using BaseAdapter instead of ArrayAdapter.
Add following to your adapter:
#Override
public int getCount() {
return placesList.size();
}
After this you most likely encounter error with getItem so you will need to override that as well to return your object from the list.
You have to override getCount() method in ArrayAdapter to initialized listview like this:
#Override
public int getCount() {
return placesList.size();
}
Trying to implement a onlick functionality for the android listview but something seems to not working. I tried to find some solutions over the internet and I found that there were recommendation to change the focusable property of imageview and textview elements. Tried it and it did not work. Appreciate if you guys can recommend any other alternatives.
Layout item.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:id="#+id/rootItemId"
android:clickable="true"
android:gravity="center_vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable='false'
android:background="#drawable/frame">
<ImageView
android:id="#+id/ivIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:contentDescription="#string/hello_world"
android:padding="5dp"
android:focusable='false'
android:src="#drawable/ic_launcher"
android:scaleType="fitXY"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:focusable='false'
android:layout_toRightOf="#id/ivIcon">
<TextView
android:id="#+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable='false'
android:textAppearance="#android:style/TextAppearance.Medium"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
list fragment
public class EventsListFragment extends ListFragment{
ArrayList<Event> eventsChildren;
#Override
public void onListItemClick(ListView l, View v, int position, long id) {
Log.e("RedditListingsClick",position + " " + id);
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
eventsChildren = new ArrayList<Event>();
EventsChildAdapter adapter = new EventsChildAdapter(inflater.getContext(), eventsChildren);
setListAdapter(adapter);
return super.onCreateView(inflater, container, savedInstanceState);
}
}
list adapter
public class EventsChildAdapter extends ArrayAdapter<Event> {
Context context;
RelativeLayout root;
private static class ViewHolder {
TextView title;
ImageView thumbnail;
}
public EventsChildAdapter(Context context, ArrayList<Event> eventsChildren) {
super(context, R.layout.item_listing, eventsChildren);
this.context = context;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// Get the data item for this position
Event child = getItem(position);
// Check if an existing view is being reused, otherwise inflate the view
ViewHolder viewHolder; // view lookup cache stored in tag
if (convertView == null) {
viewHolder = new ViewHolder();
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.item_listing, null);
//root=(RelativeLayout)convertView.findViewById(R.id.rootItemId);
viewHolder.title = (TextView) convertView.findViewById(R.id.tvTitle);
//viewHolder.thumbnail = (ImageView) convertView.findViewById(R.id.ivIcon);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
// Populate the data into the template view using the data object
System.out.println(child.getTitle());
viewHolder.title.setText(child.getTitle());
Picasso.with(this.context).load(child.getThumbnailImageURL()).resize(200, 100).into(viewHolder.thumbnail);
// Return the completed view to render on screen
return convertView;
}
}
In addition to the above, I have already tried adding android:descendantFocusability="blocksDescendants" to relativelayout but still did not work. Finally I tried to make the root relativelayout clickable and removed focus from the other elements and this did not work either.
You can try this:
public class EventsListFragment extends ListFragment implement OnItemClickListener {
...
#Override
public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
// the child callback here.
}
}
and this in onActivityCreated
setListAdapter(Your adapter);
getListView().setOnItemClickListener(this);
I am using a pattern that I have used all over my application to populate a ListView, but this time the TextView in each cell of the ListView are showing up blank. There are the correct number of cells (I can see by the dividers), but there is no text. Please see my layout XML and the code of my adapter:
The List Item XML, edit_list_item:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:focusable="true"
android:id="#+id/list_item_textview"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:id="#+id/list_item_checkbox"
android:focusable="false"
android:paddingRight="#dimen/activity_horizontal_margin"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
My Adapter class:
public class EditGroupObjectListAdapter extends BaseAdapter {
public static String LOG_TAG = EditGroupObjectListAdapter.class.getSimpleName();
private LayoutInflater mInflater;
private Context context;
private ArrayList<EditBuddy> allEditBuddies;
private List<String> buddiesInGroup;
public EditGrouphObjectListAdapter(Context context, List<String> buddiesInGroup, List<Buddy> allBuddies) {
this.context = context;
mInflater = LayoutInflater.from(context);
this.allEditBuddies = new ArrayList<>();
this.buddiesInGroup = buddiesInGroup;
for (Buddy buddy : allBuddies) {
EditBuddy editBuddy = new EditBuddy(buddy);
if (this.buddiesInGroup.contains(editBuddy.get_buddy_username())) {
editBuddy.setIsInBunch(true);
editBuddy.setIsSelected(true);
}
allEditBuddies.add(editBuddy);
}
}
public ArrayList<EditBuddy> getAllBuddies() {
return this.allEditBuddies;
}
#Override
public int getCount() {
return allEditBuddies.size();
}
#Override
public Object getItem(int position) {
return allEditBuddies.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (mInflater == null)
mInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null)
convertView = mInflater.inflate(R.layout.edit_list_item, null);
// Another way of instantiating convertView
// LayoutInflater inflater = (LayoutInflater) this.context
// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// convertView = inflater.inflate(R.layout.edit_bunch_list_item, parent, false);
EditBuddy editBuddy = (EditBuddy)getItem(position);
Log.d(LOG_TAG, "Name: " + editBuddy.get_buddy_full_name());
Log.d(LOG_TAG, "UserName: " + editBuddy.get_buddy_username());
TextView buddyFullNameTextview = (TextView)convertView.findViewById(R.id.list_item_textview);
buddyFullNameTextview.setText(editBuddy.get_buddy_full_name());
// Checkbox code omitted
return convertView;
}
}
The print statements before setting the text of the TextView are indeed printing the correct data. I have two buddies in the list, and I can see the spaces for them but no actual text.
Any help would be greatly appreciated.
Well, in this instance it seems to have been the text color was the same as the background, but there's no reason for that to have been the case. The Activity inherits the AppTheme, which has a TextColor set to black. The font of the ListView is also smaller than other ListViews in the application - so I'll have to see where the disconnect is, and then update the answer.