android-adapter

click listener + checkbox - on android

久未见 提交于 2019-12-13 04:34:35
问题 public class ChooseFavorites extends Activity implements OnItemClickListener { StationManager st; MyCustomAdapter arr; ListView list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_choose_favorites); st = new StationManager(); list = (ListView)findViewById(R.id.stationsList1); arr = new MyCustomAdapter(this, android.R.layout.simple_list_item_multiple_choice, st.getNamesOfStations()); list.setAdapter(arr);

Bug - ListView -> item -> button OnClick : Change background color of parent

╄→尐↘猪︶ㄣ 提交于 2019-12-13 04:02:05
问题 I try to change background color of a button in item of my listView, but when I try to change the background, the background change each 9 items. When I try to change the orientation of my phone, the background change each 5 items... --- IMAGE TO UNDERSTAND: http://image.noelshack.com/fichiers/2014/09/1393436440-problem.png I don't understand, is so strange. I have an Adapter created. Java.java (Not my adapter file) public void clickPresent(View v) { v.setBackgroundColor(Color.BLUE); } public

Fragments not updating in viewpager

喜夏-厌秋 提交于 2019-12-13 03:59:14
问题 I am pretty new to ViewPager and adapter world in android. I have seen this issue asked many times but did not quite understand so hoping for a simplified answer :). I have a ViewPager with 3 tabs and each tab has a fragment. By default the user first sees tab2 where he gives some imput to generate a string. this string then needs to be taken in tab3 which generates a qr code from it. the string from tab 2 is updated to a class and tab3 takes the string from there. My Problem is that when i

many listview and each one contains different objects in Kotlin

送分小仙女□ 提交于 2019-12-13 03:53:38
问题 I have 2 activity and when click on first activity to be converted to second activity it's Main2Activity inside 2nd activity I am trying to make many ListView and each one contains pictures and text, each ListView inside one specific adapter but i get a problem for represent ( adapterType1 , adapterType2 ) both adapters ( adapterType1 , adapterType2 ) return the same value of ( adapterType1 ),and i wanna to return two different result for ( adapterType1 ) and ( adapterType2 )? Here is a

calling BaseAdapter's notifyDataSetChanged() inside CustomAdapter not refreshing ListView

本小妞迷上赌 提交于 2019-12-13 03:00:45
问题 I have ArrayList<MyObject> data which is populated on the ListView using a CustomAdapter . I've implemented View.OnClickListener in the CustomAdapter class and clicking a button deletes the particular row. After deleting the row, both from database and from the data object using data.remove(i) inside the Custom Adapter, I call notifyDataSetChanged() . Problem is that it does not refresh teh ListView . I'm using a tabbed activity with fragment. So, when go to some distant tab and come back to

What happens with view references in unfinished AsyncTask after orientation change?

*爱你&永不变心* 提交于 2019-12-13 02:34:28
问题 Note this question was inspired by a comment to https://stackoverflow.com/a/33370816/519334 . I have a holder class that belongs to a GridView-item with a reference to an ImageView public static class Holder { ImageView mRowImage; String mImageUrl; // neccessary to cancel unfinished download BitmapLoaderAsyncTask mDownloader; } The corresponding GridItemAdapter uses an AsyncTask to get the image for the GridItem public class GridItemAdapter extends BaseAdapter { @Override public View getView

When the GridView scrolls, it changes its view's activated status

淺唱寂寞╮ 提交于 2019-12-13 02:28:10
问题 I create a gridview with some String. WHen I click on each of it I change its status to activated and I use that property to change the color of the selected item. All works correctly if I don't scroll the gridview, but If I selected one item and after I scroll the gridview , the item start to change its color every time that I scroll the gridview. Can you help me to find the error ? :( THis is my code : @Override public View getView(int i, View view, ViewGroup viewGroup) { ViewHolder

Click event from Adapter to Activity or Fragment in Android

↘锁芯ラ 提交于 2019-12-13 02:03:03
问题 I have customized expandable list view showing in Navigation Drawer. I have a click listener in Adapter I would like to send click event from adapter to my activity or fragment. Is this possible if so how do I go about doing it? Here is a snippet of my adapter: public class CustomAdapter implements ExpandableListAdapter { @Override public View getGroupView(int position, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout

Null Pointer Exception in LayoutInflator

老子叫甜甜 提交于 2019-12-13 01:14:27
问题 I am getting a Null Pointer Exception at LayoutInflator in my ExpandListAdapter class that extends BaseExpandableListAdaptor. import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.TextView; public class ExpandListAdapter extends BaseExpandableListAdapter{ private Context context; private ArrayList<ExpandListGroup> groups;

android recycler view adapters, viewpagers, databases, bitmaps and out of memory errors

半腔热情 提交于 2019-12-12 18:27:48
问题 hello im loading lots of little images (ex: 180x180 10.21kb) from a LOCAL database into lots of different recycler views in fragments in viewpagers in tab layouts (nested fragments.) for instance each tab has a new fragment with a recycler view with these little cards and images everything works fine but eventually it all seems to get a bit much for the system and my app is force closed with an out of memory error the error points to my adapters onBindViewHolder, which looks like this