custom-adapter

ListView Custom Adapter repeat items

余生长醉 提交于 2019-12-11 05:47:33
问题 Whats wrong with this adapter, when i scroll down i see repeated rows at the bottom and then when scroll up again i see also repeated rows at the top that were not exist before, and the rest of Data items does not appear the adapter: public class ClassesListViewAdapter extends BaseAdapter { private Context mContext; ArrayList<String> Data = new ArrayList<>(); public ClassesListViewAdapter(Context context, ArrayList<String> data) { Data = data; mContext = context; } @Override public Object

A custom ListView with a custom adapter in Android Studio

做~自己de王妃 提交于 2019-12-11 03:37:27
问题 Will I don't what is the problem. There are no errors nothing, and the program working perfectly. However, when I click on an item on list View it does not do anything. In other word the "Toast" won't pass This My main class: public class ViewListAct extends ActionBarActivity { private ListView list; private final String[] names_1 = {"McDonald's", "Subway", "Pizza Hut", "Burger King"}; private final String[] img_1 = {"mcd", "mcd", "mcd", "mcd"}; private Activity context; @Override protected

How to change layout of only selected listview row with in onitemclicklistener of listview

夙愿已清 提交于 2019-12-11 02:09:24
问题 I need to create ListView like Samsung Contact List . And I need to show custom layout for that row while that row is swiped . And also need to show contact detail at background of that row. Please give me some ideas or reference. Thank You. list.setOnItemClickListener(stationSelectionListener); final ListSwipeDetector listSwipeDetector=new ListSwipeDetector(); list.setOnTouchListener(listSwipeDetector); new UserAndMessageCount(StationListActivity.this).execute(); list.setOnItemClickListener

notifyItemInserted() in RecyclerView and animation

空扰寡人 提交于 2019-12-10 17:16:42
问题 When I'm adding a new item, I'm calling method public void addItem(ArrayList<ArrayList<String>> arrayList, int position){ this.arrayList=arrayList; notifyItemInserted(position); } and expect to see added item animated, but only previous item in recyclerView can be animated. I tried to change position like (position+1) or (position-1), but it doesn't help. Activity's code: private void showDialog(final String table_name) { ... final Cursor c = db.rawQuery("SELECT * FROM '"+table_name+"'",null)

Android: Custom Adapter with custom spinner drop down xml layout giving error

邮差的信 提交于 2019-12-10 14:54:35
问题 I have a spinner with a custom adapter that I used to set the height of the first element in the spinner drop down to zero. I do this to have a default message in my spinner (first element) without the user being able to click it, since it's not visible. package org.digitalhealthagency.elaj.util; import java.util.ArrayList; import org.digitalhealthagency.elaj.gui.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup;

Android: cannot refresh Listview using CustomAdapter

邮差的信 提交于 2019-12-10 13:14:47
问题 I need to refresh the list view with new data. This code below is used to obtain data in OnCreateView that is in FragmentActivity at the first time. override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? { val url = "something" val request_queue = Volley.newRequestQueue(this.context) val stringRequest = StringRequest(Request.Method.GET, url, Response.Listener<String> { response -> val pending_job = Gson().fromJson<ArrayList<HashMap

Selecting/highlighting multiple items in listview with custom adapter - Android

本秂侑毒 提交于 2019-12-10 02:33:33
问题 I followed a good tutorial, with some changes, to create a custom ListView that will allow me to display multiple images for each row in my ListView. What I would like to do is highlight by selecting multiple items in the list and then perform some sort of action to all of those list items by selecting an option on my Options Menu. However, the problem I seem to be running into is that I cannot select multiple items, even though I have added android:choiceMode="multipleChoice" to the ListView

How to get data from custom adapter in ListView?

拜拜、爱过 提交于 2019-12-09 15:59:05
问题 here is my problem : I created a custom adapter for my ListView and I get information out of a List that I give to that adapter in order to let him fulfill my ListView. He does everything correctly. Now I'd like to implement an OnItemClickListener and to get the data from it. But in that list I have 4 TextViews ... How can I retrieve the data ? I already know how to get the id and position since I display them in a Toast. Thanks a lot for your help ! Here is the custom Adapter : public class

Android AutoCompleteTextView shows object information instead of text in landscape mode

女生的网名这么多〃 提交于 2019-12-09 15:04:54
问题 I am using a Custom Adapter with AutoCompleteTextView. It works fine on the emulator and my tablet. However, there is an issue on my phone in landscape mode. The auto complete hints being shown in this mode are object info rather than text. However, when I select any item the fields gets populated correctly with text in the respective fields. Auto Complete for other fields that are based on Android Stock Array Adapter works fine. Do I have to do something for this in my Custom Adapter? I saw

How can inflate a layout containing listview in a alert dialog?

倾然丶 夕夏残阳落幕 提交于 2019-12-09 14:45:56
问题 I am using a listview with a custom adapter in a layout. Now i am trying to bring that layout containing list to my alertdialog. I tried to bring simple layouts not containing list to alert dialog with this code and its is working good. But i am unable to bring the list containing layout into alertdialog. AlertDialog.Builder dialog = new AlertDialog.Builder( this ); dialog.setView( getLayoutInflater().inflate( R.layout.smill, null ) ); dialog.setIcon(R.drawable.androidsmile); dialog