android-listview

Cursor not binding text correctly with custom adapter

一个人想着一个人 提交于 2019-12-07 21:37:30
问题 My Custom Adapter that extends SimpleCursorAdapter for my ListFragment does not display the items in my database correctly. it does not display the text in the TextView, what else do I have to do to the cursor for it to show the correct text? I thought I had to override the bindView but that had no effect Setting the adapter: public void populateList(){ String[] fields = new String[] {BowlersDB.NAME}; Cursor c = getActivity().getContentResolver().query(BowlersDB.CONTENT_URI, new String[]

Android UI - add buttons dynamically to Gridview

喜欢而已 提交于 2019-12-07 21:07:48
问题 This is where I am stuck now. I am stuck at dynamically adding buttons to gridview. - My gridview stars with a one button. - When user clicks that button a context menu , pops up, asking user to enter info, once that is done. A block in the grid view is created with that info - This is shown in the picture I have pasted the code. I do not have clear idea on how to do it. I am assuming it will be inflating a new view and adding it to parent(layout or grid ?) view. I do not have much idea on

set button onclick event for every row of listview

最后都变了- 提交于 2019-12-07 19:34:45
问题 i populate listview via json parsing using AsyncTask. in every row of list view i have a button. i want to write onclickLister for them. i want, when i click add to cart the data of name and price and quantity save to sqlite. public void addtocart(){ Button btnaddtocart=(Button)findViewById(R.id.btnInsertToCart); final TextView tname=(TextView)findViewById(R.id.nameNewItem); final EditText eqty=(EditText)findViewById(R.id.updateQty); final TextView tprice=(TextView)findViewById(R.id

Format data between SQLite and ListView

淺唱寂寞╮ 提交于 2019-12-07 19:31:31
I'm sure there must be a simple solution to this... I have a SQLite database, and I'm using the standard SimpleCursorAdaptor to put the database into a ListView. No problems there. However, I would like to be able to format some of the data in between the database and the ListView. For example, I want to divide all the data in the "price" column by 100 (in the database a price might be "5400", I want it displayed as "54.00"). Use SimpleCursorAdapter.ViewBinder : SimpleCursorAdapter simpleCursorAdapter = new SimpleCursorAdapter(..); simpleCursorAdapter.setViewBinder(new SimpleCursorAdapter

Endless scrolling ListView

☆樱花仙子☆ 提交于 2019-12-07 19:25:35
I am populating a ListView with data fetched from an online service, which provides the data in pages. Rather than providing a 'next page' button, I am attempting to automatically load the next page of data when the user scrolls near the bottom of the page. Data is fetched using an AsyncTask: class RecentTracksTask extends AsyncTask<Integer, Void, Void> { ArrayList<Track> recentTracks; @Override protected Void doInBackground(Integer... page) { try { // Get a page of 15 tracks // Simplified - getPage accepts 'page' and 'limit' parameters and returns a Collection<Track> recentTracks = new

Android java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView

与世无争的帅哥 提交于 2019-12-07 19:23:19
问题 I'm trying to print the value that has been clicked on in the listView, but then i'm getting the following exception: 07-04 10:40:56.482: E/AndroidRuntime(1356): FATAL EXCEPTION: main 07-04 10:40:56.482: E/AndroidRuntime(1356): java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView 07-04 10:40:56.482: E/AndroidRuntime(1356): at com.passwordkeeper.ui.ActivityHomeScreen$1.onItemClick(ActivityHomeScreen.java:88) Here is a code snippet: protected void

How to put query of information into a listview?

丶灬走出姿态 提交于 2019-12-07 18:53:26
问题 I have a ListView <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ListView android:layout_height="wrap_content" android:id="@+id/listView1" android:layout_width="match_parent"> </ListView> </LinearLayout> I am retreiving a query of information from a URL feed. Here is an example of how i retreive the feed. query.setOrderBy

Android Google Play navigation drawer style

孤人 提交于 2019-12-07 18:16:45
问题 There is any tutorial or code how to make the navigation drawer listview will be show like Google Play or Google Play Music Navigation Drawer? I want my Nav Drawer look like this: Can you help me with this? Thanks Haim. EDIT:I know how to build navigation drawer, I want a style for the navigation drawer that my nav drawer will look like the google play navigation drawer(big listview tabs....). If you can write the code. EDIT2:I used this: https://www.youtube.com/watch?v=9WeQzZUroAs 回答1: Yes

enter multi-choice mode with nothing selected

自古美人都是妖i 提交于 2019-12-07 17:35:48
问题 our UX asks for a button to start multi-choice mode. this would do the same thing as long-pressing on an item, but would have nothing selected initially. what i'm seeing in the code is that i cannot enter multi-choice mode mode unless i have something selected, and if i unselect that item, multi-choice mode exits (contextual action bar closes). i've also tried this in other apps (gmail), and it works the same way. is there a way to be in multi-select mode, with no items selected? thanks. 回答1:

Android: InflateException in custom ListView

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 16:57:33
问题 While inflating custom ListView row layout I'm getting this exception. E/AndroidRuntime(1241): android.view.InflateException: Binary XML file line #6: Error inflating class <unknown> See the code below for reference... CustomListViewAdapter.java public View getView(final int position, View convertView, ViewGroup parent) { holder = null; ListViewRowData rowItems = (ListViewRowData) getItem(position); LayoutInflater inflater = (LayoutInflater) context .getSystemService(Activity.LAYOUT_INFLATER