android-adapter

Adapter for a spinner makes NullPointerException

巧了我就是萌 提交于 2019-12-25 06:38:46
问题 I made an array list in one of my value's folder, now when i want to adapt it to the spinner by retrieving it from the source folder it says NullPointerException : spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter adapter = ArrayAdapter.createFromResource(this,R.array.worker,android.R.layout.simple_list_item_1); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); Messages in LogCat: Caused by: android.content.res.Resources$NotFoundException: String array resource

Add data to custom ListView scrolling list

主宰稳场 提交于 2019-12-25 04:34:40
问题 I implemented a custom adapter to fill a custom ListView with one image and 2 TextField . Now what I want to do is to add new rows dynamically scrolling down the list. Ho can I do achieve this results? This is the code of the adapter public class CustomListAdapter extends ArrayAdapter<String> { private final Activity context; private final String[] itemname; private final Integer[] imgid; private final String[] questions; public CustomListAdapter(Activity context, String[] itemname, Integer[]

GridView, Get Item's parent View

て烟熏妆下的殇ゞ 提交于 2019-12-25 03:15:14
问题 I'm trying to send clicks to my child elements in GridView with a single touch event. So far, I can retrieve the data of the child element, but cannot perform a click on it. Let me explain a bit more on the layout of things... GridView - Touch Event Handler here... LinearLayout - onClick listeners here... TextView - Just some text... An adapter fills GridView with LinearLayout 's who have onClick events defined. These layouts contain TextView s where TextView.setText("Some data from my

Save Images locally in Image adapter in android

五迷三道 提交于 2019-12-25 02:52:17
问题 This is a question about image saving in android app. I am trying to make popular movies app of an udacity project.Link - https://docs.google.com/document/d/1gtXUu1nzLGWrGfVCD6tEA0YHoYA9UNyT2yByqjJemp8/pub?embedded=true I have picasso library for image downloading in ImageAdapter-- Here is my ImageAdapter code - package jindal5.mayank.popular_movies_14ce10032_gsc; public class ImageAdapter extends BaseAdapter { private String drawablePrefix; private Context mContext; private ArrayList<String>

Listview getting refreshed after scrolling the list in android

孤街浪徒 提交于 2019-12-25 02:39:06
问题 thanks in advance , please forgive me if I am mistaking somewhere when explaining the question I have a Listview and a custom ArrayAdapter and the layout for the custom ArrayAdapter is as follows. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true"

“No adapter attached; skipping layout” on a fragment

痴心易碎 提交于 2019-12-25 01:23:15
问题 public class WorkFragment extends Fragment { List<CardViewItem> items = new ArrayList<>(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("FRAGMENT", "Work Fragment started"); TypedArray icons = getResources().obtainTypedArray(R.array.project_icons); TypedArray names = getResources().obtainTypedArray(R.array.project_names); TypedArray descs = getResources().obtainTypedArray(R.array.project_descs); for (int i=0;i<icons.length();i++){ items

Iterate through ListView in custom Adapter

纵然是瞬间 提交于 2019-12-24 22:40:17
问题 I have a custom ListView . Each row contains a TextView and ImageView . Look at screenshot: On Item click I make that ImageView visible. But the problem is that only ONE ImageView should be visible at a time. I think that the best approach is to set all other ImageViews as INVISIBLE on click. And after all images gone make a clicked one VISIBLE . But I don't know how to iterate properly that in Adapter : private class TimeZoneItemAdapter extends ArrayAdapter<String> { private Activity

Wrong object selected with ItemTouchHelper

て烟熏妆下的殇ゞ 提交于 2019-12-24 19:38:58
问题 I have a problem with my recyclerView. I'm developing a "ToDo" App where the user can add some tasks to do and these tasks are displayed with a recyclerView. I'm also using Room, so I have a ViewModel, a Repository and a DAO. Inside the method onOptionsItemSelected (MainActivity) I have some filter like "Pending Tasks", Private Tasks, ... I would like to use an ItemTouchHelper to delete (swipe Left) and update a task from "pending" to "completed" (swipe Right). PROBLEM When I start the app I

Android GridView getChildAt(0).findViewById() returns null

邮差的信 提交于 2019-12-24 17:00:19
问题 I have a GridView with some items, I used a custom adapter that extends BaseAdapter . each row shows a downloadable item, each row has an icon that show download progress. So I need to update this icon. For this update, I know that I can change the data and call notifyDataChanged() and the view will get updated, but this approach costs me a lot of changes and I don't want to do this. So I tried to get a specific child from the gridview , find this icon and change the icon, But the returned

Spinner with customer adapter throwing Resources$NotFoundException when dropdown is clicked in Android

落花浮王杯 提交于 2019-12-24 13:33:33
问题 I am developing an Android app. In my app, I am working with spinner view. But I am using spinner view with custom adapter because my spinner with will be more complicated soon. All the data for spinner come from server through volley. My spinner view with customer adapter is showing the data properly. But the problem is when I click the dropdown to choose item. It throws exception. This is my customer adapter for spinner view: public class SpinnerItemAdapter extends ArrayAdapter<NVItem> {