android-listview

Capture swipe to dismiss listview gestures in ViewPager

◇◆丶佛笑我妖孽 提交于 2019-12-06 14:26:04
问题 I have a ListView that captures swipe gestures to delete a row. This ListView lives in a Fragment . On phones this is in it's own Activity and works great. On tablets this Fragment is in a ViewPager and the ListView is never able to capture any of the the swipe events since they always go to the ViewPager . How would I go about making sure swipe gestures are captured by the ListView to consume before they are passed to the ViewPager ? P.S. I am using this library for my swipe to dismiss

Android ListView listSelector not working

不羁的心 提交于 2019-12-06 14:10:09
I am trying to set a custom selector to a ListView. It's working fine on newer devices but not working on lower version of devices.I want the ListView selected item to be stay highlighted. Please help. Thanks in advance. ListView.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:id="@+id/listViewBell" android:layout_width="fill_parent" android:layout_height="wrap_content" android:cacheColorHint="#00000000"

Saving the contents of the ListView after drag and drop

允我心安 提交于 2019-12-06 14:09:44
问题 Initially I am having a simple ListView Activity that consists of few formulae and also a Button at the top.Whenever I click that Button it takes me to another Activity,where in I am dragging and dropping the contents of the ListView.This Activity also consists a Button and whenever I click this Button the order of the contents which I have changed in my drag and drop Activity has to be saved in my initial Activity.How do I save the contents of ListView which I have changed in my drag and

show data from database to listView Android

我只是一个虾纸丫 提交于 2019-12-06 13:56:59
I am trying to show all my data from my database into the listview Code to create database: DataHander.java package com.example.testingforstack; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DataHandler { public static final String NAME = "name"; public static final String EMAIL = "email"; public static final String TABLE_NAME = "mytable"; public static final String DATA_BASE_NAME = "mydatabase

Create a Context Menu when Click Long in a Custom ListView

瘦欲@ 提交于 2019-12-06 13:47:54
问题 I want to show a context menu (OnClickLong)with delete and edit option, in a custom list i created with a custom list adapter. i will post the code SpotListFragment package com.pap.myspots.fragments; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import com.pap.myspots.R; import com.pap.myspots.R.layout; import com.pap.myspots.database.DBAdapter; import com.pap.myspots.listView.SpotList; import com.pap.myspots.listView.SpotListAdapter; import android.annotation

How to delete a custom listview item in android?

筅森魡賤 提交于 2019-12-06 13:44:31
I have a listview and a button in my layout file. I'am adding items to listview on click of that button. The listview should be empty when the activity is started but it should grow by adding the items to it. This is my code inside onCreate() : list = (ListView)findViewById(R.id.inverterListView); adapter = new ArrayAdapter<String>(InverterList.this, R.layout.inverters_list_row, R.id.inverterNumberTextViewInPanelListRow); list.setAdapter(adapter); And here iam adding the items to listview onclick of a button. adapter.add(inverterNo); adapter.notifyDataSetChanged(); This works fine. Can anyone

android: dynamic listview focus returning to first item every time after loosing focus from other item

為{幸葍}努か 提交于 2019-12-06 13:32:24
问题 I am using two list-view's list_A and list_B with same number of list items as shown in figure 1, where in list_B is custom array adapter with each item as list(string) creating the button dynamically of required width. public class LarrayAdapter extends ArrayAdapter<List<String>> { private final Context context; private List<List<String>> list; public LarrayAdapter(Context context, List<List<String>> list) { super(context, R.layout.hrowlayout, list); this.context = context; this.list = list;

ListView Reorder Items

浪尽此生 提交于 2019-12-06 13:14:48
I tried to look answers but I couldn't find any. So I want to change my ListView items order in app and I don't have any idea how to do that. I guess Drag and Drop is too hard to build but how about some arrow buttons where you can press up and item move one row up? And how to make app to remember order that next time I open it every item are in order where I moved them? I have my ListView Items in their own file (values->arrays.xml). And here is my ListView activity: public class MainScreen extends ListActivity implements OnClickListener{ /** Called when the activity is first created. **/

How to embed view of Fragment in the header of a ListFragment

折月煮酒 提交于 2019-12-06 12:55:13
I have a FragmentActivity where I'm dynamically adding Fragment s in my onCreate . I want a Fragment above a ListFragment . Of course, the first thing I tried was the fragments in one LinearLayout in one ScrollView , but then the ListFragment would only show one row at a time. I found Scrolling 2 fragment (one Fragment and one ListFragment) as one , but I don't know how to get the parent view of the Fragment to add to the header view of the ListFragment . I obviously get an NPE when call fragment.getView() and fragment.getView().getParent() because I'm still in the onCreate of my activity, so

Strange behaviour in Android listview when loading images with asynctask

戏子无情 提交于 2019-12-06 12:53:33
I hope anyone can help me with the ListView problem I got.I have been slamming my head against a iron wall yesterday because i could not figure out what the problem was. It's not originally my project which makes it even harder. I got a listview where I wanna load rows of contacts in. On the left side of each row I wanna (Down)load an Image async. For this i am using the following ArrayAdapter and ListItem layout, please ignore the deprecated functions. Here is a video http://www.youtube.com/watch?v=aMqI9_y3pag&feature=youtu.be PROBLEM: Whenever the list loads all the images get loaded over