android-arrayadapter

Android custom ArrayAdapter getView method called multiple times - resetting dynamic TextView value

孤人 提交于 2019-12-19 07:48:37
问题 The getView method in my custom ArrayAdapter is getting called multiple times, which I assume it is meant to. Problem is, I have a quantity TextView which is dynamically set but when you scroll and the box goes off screen the value disappears. I am not sure what I am doing wrong and Google is not proving to be much help. Hopefully someone here can help me. The adapater is called: adapter = new MenuAdapter(thisActivity, R.layout.menu, list); setListAdapter(adapter); My Custom ArrayAdapter:

Android Custom ArrayAdapter doesn't refresh after filter

别来无恙 提交于 2019-12-19 07:36:45
问题 So I have a custom ArrayAdapter so I can use the Title/Subtitle view that is available on the ListView . I have an EditText that accepts a string and filters the adapter. The filter works in the sense that it is filtering the correct objects (I can tell by clicking on it and it starts the intent with the correct "extras".) However even though the filtering works, the items in the adapter are not updated to display the correct information... The title and subtitle are incorrect. Lets say we

Cannot infer type arguments for ArrayAdapter<>

狂风中的少年 提交于 2019-12-19 06:01:19
问题 I am still playing around with my calendar, I already nearly managed to integrate the https://github.com/SundeepK/CompactCalendarView into one of my fragments. There is just one error left, i did some research, others got the problem too for example with ArrayList<>. Example code: final ArrayAdapter adapter = new ArrayAdapter<> (this,android.R.layout.simple_list_item_1, mutableBookings); The IDE says: Error:(87, 38) error: cannot infer type arguments for ArrayAdapter<> Note: C:...\Uebersicht

Video thumbnail arrayadopter is slow on scroll

余生长醉 提交于 2019-12-19 03:24:24
问题 I have created an adopter to display images thumbnail of video form the specific folder but when I scroll it lags a little but why is that? Below is the code: Main activity class public class TestvideolistingActivity extends ListActivity { String filename = null; String filePath = null; String dirNameSlash = "/videotest/"; String dirName = "videotest"; String path = Environment.getExternalStorageDirectory() + dirNameSlash ; String[] values; String deleteFile ; @Override public void onCreate

ListView Not Updating After Filtering

三世轮回 提交于 2019-12-18 12:56:21
问题 I have a ListView (with setTextFilterEnabled(true)) and a custom adapter (extends ArrayAdapter) which I update from the main UI thread whenever a new item is added/inserted. Everything works fine at first--new items show up in the list immediately. However this stops the moment I try to filter the list. Filtering works, but I do it once and all of my succeeding attempts to modify the contents of the list (add, remove) don't display anymore. I used the Log to see if the adapter's list data

how to add item to Spinner's ArrayAdapter?

我的梦境 提交于 2019-12-18 12:19:09
问题 i had a EditText , a button and a spinner . When click the button , the spinner will add a new item with name you entered in the EditText. But here is the question, my adapter.add() method seems doesn't work...here is my code: public class Spr extends Activity { Button bt1; EditText et; ArrayAdapter<CharSequence> adapter; Spinner spinner; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); bt1 = (Button)this

How to Refresh Android List Adapter, so it shows new-added items

痴心易碎 提交于 2019-12-18 08:10:32
问题 I was working on a project. It's just showing a list of tasks and Adding new tasks to it. I have 3 CLASSES. One for adding, One for view and One to hold all information (or so I think). I have 2 tasks in my List already, and they are shown properly. The problem is, when I add a new task it won't show them in view. I have tried many possible solutions: simply adding item to list creating a new list that consists items from old one and rebuilding adapter; using notifyDataSetChanged(); alongside

Display HTML Formatted String

故事扮演 提交于 2019-12-18 04:10:09
问题 I need an example of how to display the strings that I have marked up with simple html into a TextView. I have found "Spanned fromHtml(String source)", but I don't know how to plug it into my java code. Here is my Java: package com.SorenWinslow.TriumphHistory; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; public class TriumphHistory extends ListActivity { String[] HistoryList; /** Called when the activity is first created. */ @Override public

listview not updating with notifydatasetchanged() call

白昼怎懂夜的黑 提交于 2019-12-18 03:56:44
问题 This is my code listview =(ListView) findViewById(R.id.lv1); ArrayList<SClass> Monday = new ArrayList<SClass>(); SClass s1=new SClass(); s1.sName="samp"; s1.salary=1000; Monday.add(s1); temp=Monday; adapter = new CustomAdap(this, temp); listview.setAdapter(adapter); The above code works fine.But when i change my code to this listview =(ListView) findViewById(R.id.lv1); adapter = new CustomAdap(this, temp); SClass s1=new SClass(); s1.sName="samp"; s1.salary=1000; Monday.add(s1); temp=Monday;

AutoCompleteTextView - disable filtering

廉价感情. 提交于 2019-12-18 00:40:12
问题 I'm retrieving a list of strings from a webservice and I want to list them up on a AutoCompleteTextField regardless of the built-in AutoCompleteTextField filters. How do I do that? is there a way to disable it's inner filtering easily (preferably without subclassing) I've loaded all my results into a ArrayAdapter , the problem is that some of them don't show up because of the filtering. If I'm going in the wrong direction please point me to the right direction. 回答1: Probably @Alon meant