android-listview
Best way to reorder items in Android 4+ ListView [closed]
This question is quite old however it comes first when you search for “Best way to reorder list items in Android” and it remained without an answer. The OP asked for ListView as at the time of the question they were the most commonly used. Today, it is better to use the RecyclerView as it … Read more
Animate selector/state transitions
Added in api 21 “StateListAnimator” http://developer.android.com/reference/android/animation/StateListAnimator.html I know this is an old question but this may help future people looking to do this.
How can I update information in an Android Activity from a background Service
How can I set up my Activity to be listening to the Service? Is this the best way to approach this problem? You have three major options, as I see it: Polling. The Activity periodically asks the Service for the latest data. IMHO, this option sucks, but it’s certainly possible. Callbacks. Per jax’s answer, the … Read more
How to set the ListView Rows Height
the problem is that you are mis-using the inflator, don’t give null as the root node if you pass null as the root node, all the size parameters you set in the xml fail to work the correct code is view = inflater.inflate(R.layout.lview_row, parent, false); http://www.doubleencore.com/2013/05/layout-inflation-as-intended/
Android getting exact scroll position in ListView
Okay, I found a workaround, using the following code: View c = listview.getChildAt(0); int scrolly = -c.getTop() + listview.getFirstVisiblePosition() * c.getHeight(); The way it works is it takes the actual offset of the first visible list item and calculates how far it is from the top of the view to determine how much we are … Read more
Remove item listview with Slide – Like Gmail
This is how I realize this effect. We have a ListView lvSimple and we add onTouchListener to our lvSimple. This is my working code. float historicX = Float.NaN, historicY = Float.NaN; static final int DELTA = 50; enum Direction {LEFT, RIGHT;} … ListView lvSimple = (ListView) findViewById(R.id.linLayout); … lvSimple.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View … Read more
Unable to start activity:UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
what should i do??? Correct your code. UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView A subclass of AdapterView like a ListView can’t have children manually added either in the layout file or added in code. So if you have this in one of your layouts: <ListView // .. other attributes> <// other views <– … Read more