android-listview

populating a list view with sql database items

大憨熊 提交于 2019-12-04 19:02:46
My application is based on displaying a dialog box when the user enters the "add category" button. It then should save data into an SQL Database and populate a list view with each item the user adds. I chose SQL database because I want the data to be saved when the user ends the app. How do I actually populate the list view with those items ? Here is what I have so far: public class CategoryDatabase { public static final String KEY_ROWID = "_id"; public static final String KEY_CATEGORY = "category"; private static final String DATABASE_NAME = "DBCategory"; private static final String DATABASE

Android - Populating a listview using fragments and a Simple cursor adapter

a 夏天 提交于 2019-12-04 18:36:06
I know that this question is probably asked a hundred times so far, but i still haven't manage to solve my problem. I have one activity that's comprised of 2 fragments. One fragment is a form that adds information to the database: **R.layout.fragment_add_server:** <?xml version="1.0" encoding="utf-8"?> ... <LinearLayout android:id="@+id/nameLinear" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_marginLeft="5dp" > <TextView android:id="@+id/nameText" android:layout_width="fill_parent" android:layout_height="wrap_content"

Html <a> tag not working in Android textview

别来无恙 提交于 2019-12-04 18:33:46
I'm trying to display JSON results in a textview (that resides within a listview). One of the Results is a URL which has to be displayed as "View results". I'm using the following code to display the URL as "View Results": String result = "<a href=\"" + jsonObject.get("url") + "\">" + getString(R.string.hyperlink_text) + "</a>" + "\n"; bbieResults.put("Result", Html.fromHtml(result)); The related xml layout: <TextView android:id="@+id/list_result" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/list_label" android:layout_marginLeft="10dp"

UIL, Picasso - Images in adapter always reload when stop scrolling

巧了我就是萌 提交于 2019-12-04 18:03:52
问题 I have ListView with text and large image from internet. My image item has fit width and wrap_content height. I tried to display image in background with UIL & Picasso . Both of them can work but the image always reloads when I stop scrolling, and it makes ListView flickering It looks like this: You can see that it reload downloaded and cached images when I stop scrolling (I scroll down and then scroll up) . How can I prevent this happen? <ImageView android:id="@+id/imgFeed" android:layout

Android Custom wheel or slot machine implementation

半腔热情 提交于 2019-12-04 18:00:12
问题 I need to implement a wheel like control (a slot machine) like in the picture. But the edges (the position between the items) of each item need to be smoothened so that it will look like a globe like the earth. This is a screen shot of iPhone app achieved from a library for iPhone. I want it in android. I checked the kankan wheel (Android wheel) but it does not serves my needs. However it's cyclic behavior is needed for me. And I checked the following link also. http://developer.sonymobile

Contextual action bar does not overlay my toolbar

北城以北 提交于 2019-12-04 17:51:37
问题 I have created an activity and set toolbar as the actionbar which i have positioned at the bottom. Inside that activity, I have a listview that contain some data. Problem is, when I long press a list item, contextual action bar appears at the top instead of overlaying my toolbar which is positioned at the bottom. my activity theme <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Base application theme. --> <style name="myActivityTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item

Add New Item in Listview dynamically

泄露秘密 提交于 2019-12-04 17:45:01
I am a beginner and I want to add items in my Predefined array public class MainActivity extends ListActivity { //LIST OF ARRAY STRINGS WHICH WILL SERVE AS LIST ITEMS ; String listItem[]={"Dell Inspiron", "HTC One X", "HTC Wildfire S", "HTC Sense", "HTC Sensation XE"}; ArrayAdapter<String> adapter; EditText et; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); adapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listItem); setListAdapter(adapter); et=(EditText) findViewById(R.id.editText); } public void addItems(View v

Does anyone know how to highlight a selected item in a Android listView?

好久不见. 提交于 2019-12-04 17:37:35
I'm trying to create a listview where upon tapping an item the background changes color. So far my current implementation results in the "opposite" visible cell having its background changed. For example, if I chose the top item in the list, the bottom item is highlighted. Can anyone help me implement the desired functionality? My list Activity: public void onCreate(Bundle savedInstanceState) { Log.e(TAG, "Starting Symptom Activity..."); super.onCreate(savedInstanceState); setContentView(R.layout.symptom_listview); // Setup list this.setupSymptomScreen(); startManagingCursor(cs); //get handle

OnItemCLickListener not working in ListView custom adapter

你说的曾经没有我的故事 提交于 2019-12-04 17:12:33
I have two activities. One displays all the products in a ListView . Second activity runs when an item is selected. Basically second activity should fire up on item click and it should open the PDF file. Well the thing is that it does not fire up 2nd activity on item select. Posting the code for your reference. My .xml file <?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="wrap_content" android:layout_margin="5dp" android:background="@drawable/list_bacg" android:orientation=

Selector, in listview (swipe-listview) row, stays in state pressed after re-instanciating the adapter

三世轮回 提交于 2019-12-04 16:55:11
I have a listview and the row's layout has a child with the background set to the following selector : <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape android:shape="rectangle"> <solid android:color="@color/pressed_panel" /> <corners android:radius="@dimen/rounded_panel_corners" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#ffffff" /> <corners android:radius="@dimen/rounded_panel_corners" /> </shape> </item> And now this scenario happens: I instantiate the adapter and set it to the listview,