baseadapter

GridView items are too small - Android

隐身守侯 提交于 2019-12-24 02:58:07
问题 I am following this tutorial, it is very simple, and yet my GridView images are much much smaller than the one in the tutorial. Does anything stand out as wrong code? Below I've included my main activity, my adapter class, and my xml with the GridView . It should be like this: Instead, mine is like this: SitesActivity.java package org.azurespot.cutelinks; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import

IndexOutOfBoundException when I use notifyDataSetChanged

吃可爱长大的小学妹 提交于 2019-12-23 18:40:24
问题 I Founded my problem in this post Updating ExpandableListView with notifyDataSetChanged() "each time you refresh the the views using setNotifyDatasetChanged the Adapter will call the loop around the List. and you List in the Adapter gets a null value due to the changes you made." I am beginner and can not properly make changes to the list my sources public class UrlArrayAdapter extends ArrayAdapter<UrlItem> { private LayoutInflater inflater; private ListView urlListView1; private ArrayList

ListView with a custom adapter, adding elements one by one

守給你的承諾、 提交于 2019-12-23 11:07:39
问题 Reading this question, I tried the example given in the answer and it's working fine. Now I want to do the same but with a custom adapter using a Student class. So I have: public class AsyncDemo extends ListActivity { private static final String[] items={"lorem", "ipsum", "dolor", "sit", "amet", "consectetuer", "adipiscing", "elit", "morbi", "vel", "ligula", "vitae", "arcu", "aliquet", "mollis", "etiam", "vel", "erat", "placerat", "ante", "porttitor", "sodales", "pellentesque", "augue",

ListView with a custom adapter, adding elements one by one

拟墨画扇 提交于 2019-12-23 11:07:32
问题 Reading this question, I tried the example given in the answer and it's working fine. Now I want to do the same but with a custom adapter using a Student class. So I have: public class AsyncDemo extends ListActivity { private static final String[] items={"lorem", "ipsum", "dolor", "sit", "amet", "consectetuer", "adipiscing", "elit", "morbi", "vel", "ligula", "vitae", "arcu", "aliquet", "mollis", "etiam", "vel", "erat", "placerat", "ante", "porttitor", "sodales", "pellentesque", "augue",

onclick image change on baseadapter

大憨熊 提交于 2019-12-23 05:18:21
问题 I want to change imageview source (and music of course) from onclicklistener. It is change, but first image changing every click. How can i fix it? (Sorry for my bad English) enter code here public View getView(final int p, View v, ViewGroup arg2) { Log.w("BaseAdapter", "p: "+p+", preP: "+preP ); if (v == null) v = li.inflate(R.layout.listview_item, null); ImageView iv = (ImageView) v.findViewById(R.id.imageView1); TextView baslik = (TextView) v.findViewById(R.id.textView1); baslik.setText(

Listview rows getting mixed colors when loading and scrolling

本秂侑毒 提交于 2019-12-23 02:40:57
问题 I'm setting the background color of a row based on a text value of one of it's children. However, multiple backgrounds are being set regardless of its text value. It gets worse when scrolling up and down. The code for the adapter: package com.test.app; import java.util.ArrayList; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView

context parameter for custom adapter - getApplicationContext() fails but 'this' works

天涯浪子 提交于 2019-12-23 02:04:26
问题 I have simple code snippet to implement custom list view. In this code, I have CustomAdapter class which extends ArrayAdapter : CustomAdapter adapter = new CustomerAdapter(getApplicationContext(),R.layout.listview_item_row, weather_data); The constructor of CustomAdapter is as below: public CustomerAdapter(Context context, int layoutResourceId, weather[] data) { super(context, layoutResourceId, data); mlayoutResourceId = layoutResourceId; mcontext = context; mdata = data; } If I write this,

context parameter for custom adapter - getApplicationContext() fails but 'this' works

亡梦爱人 提交于 2019-12-23 02:04:15
问题 I have simple code snippet to implement custom list view. In this code, I have CustomAdapter class which extends ArrayAdapter : CustomAdapter adapter = new CustomerAdapter(getApplicationContext(),R.layout.listview_item_row, weather_data); The constructor of CustomAdapter is as below: public CustomerAdapter(Context context, int layoutResourceId, weather[] data) { super(context, layoutResourceId, data); mlayoutResourceId = layoutResourceId; mcontext = context; mdata = data; } If I write this,

getView showing random items when scrolling

流过昼夜 提交于 2019-12-23 01:41:45
问题 I have my class PlannerListAdapter that extends BaseAdapter and i have 2 problems in my getView() method. 1) When i set my adapter to the listview, everything it's ok, the listview show me all the elements i have in my List, I scroll down and i can see all the elements of the list. But when i scroll up, the elements starts to switch each other and also are being repeated, also, it is changing me the order of the elements, why is this happening? 2) In my BrandPlannersList i have a String[]

android listview order changed when called notifyDataSetChanged

China☆狼群 提交于 2019-12-22 19:08:21
问题 all. when I use notifyDataSetChanged(), the listview display order will be change . like this 3 2 1 when current activy was created. but when I change the data. it will be 1 2 3 I don't want the order changed and i dont understand why its happening. This is a piece of code from my adapter class public static class ItemAdapter extends BaseAdapter { private String[] mData; private LayoutInflater mInflater; // I called this method to change data public void setEditText(int position, final String