android-listview

Filtering list of apps in custom baseadapter

空扰寡人 提交于 2019-12-06 16:21:33
问题 I am trying to implement a searchview for my listview of my installed apps with my baseadapter class. Currently it looks like this: The problem is that when I hit it crashes with 09-02 19:56:47.925 1628-1628/com.spicycurryman.getdisciplined10.app.dev E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.spicycurryman.getdisciplined10.app.dev, PID: 1628 java.lang.NullPointerException at com.spicycurryman.getdisciplined10.app.BlockActivity$2.onQueryTextSubmit(BlockActivity.java:126) because I'm

How to resize a ListView when new rows are added?

萝らか妹 提交于 2019-12-06 16:11:56
So I have this: ...<!--Stuff above--> <ListView android:id="@+id/reminders_list" android:layout_width="match_parent" android:layout_height="wrap_content"></ListView> ...<!--More stuff below--> My problem is when I try to add more rows it does not work because the adapter doesn't add more views if there is no more space. At least in this instance. This means I need to resize it dynamically. Question is how to do this? If something besides resizing is possible I would rather do that. Thanks in advance. Venky Problem is with your android:layout_height="wrap_content" Setting height as wrap_content

Checking RadioButton of RadioGroup in ListView checks other item button

半世苍凉 提交于 2019-12-06 15:36:39
here is adapter class..... public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder=null; Student temp = (Student) getItem(position); if (convertView == null) { convertView = mInflator.inflate(R.layout.item_class_student, null); holder = new ViewHolder(); holder.nameTextView = (TextView) convertView.findViewById(R.id.row_student_name); holder.classTextView = (TextView) convertView.findViewById(R.id.row_student_class); holder.rollNumberTextView = (TextView) convertView.findViewById(R.id.row_student_roll_number); holder.image = (ImageView) convertView

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

吃可爱长大的小学妹 提交于 2019-12-06 15:31:38
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, the logcat shows following error: Java.lang.ClassCastException: android.app.Application context can not

How get Vertical Button view from xml

别说谁变了你拦得住时间么 提交于 2019-12-06 15:29:12
I want create a Button in Vertically.May be we can by extending a button and re-render(rotate) the canvas to vertical we can get the custom Button. But i need it from xml.check the graphical representation.i need a button like this. Please, see link below, there should be solution for your problem http://blog.stylingandroid.com/archives/796 This is tutorial about how to create vertical-textView But because of Button class extends TextView this tutorial should work for Buttons too UPDATE : 1) Create a style in res/values/styles.xml which we’l use later: <?xml version="1.0" encoding="utf-8"?>

set button onclick event for every row of listview

*爱你&永不变心* 提交于 2019-12-06 15:09:37
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.priceNewItem); btnaddtocart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View

swapCursor() slow: “The application may be doing too much work on its main thread.”

◇◆丶佛笑我妖孽 提交于 2019-12-06 15:02:35
问题 I keep seeing "The application may be doing too much work on its main thread." Is this being caused by swapCursor() in my code below? It appears so: if I remove it, the above warning disappears. I still don't understand why it claims to be the main thread that is causing the problem. I have moved the swapCursor() around into various places such as onLoadFinished() and in loadInBackground() but I get the same result. How can I call swapCursor() so that this warning doesn't appear? The whole

Expanding in Context in a ListView - Android

大城市里の小女人 提交于 2019-12-06 14:51:26
问题 I have a listView, one component of the row is a TextView. By default, I wish to show only 2 rows of text in the TextView. But if the user taps on the TextView I wanted to the textView to expand in context. I actually have this portion working, but I want to have a more content indicator : My current implementation (Below) has it's own issues w/ not collapsing if the list view is scrolled, but I will handle that by storing the values for each cursor record in some collection.. I tried using

Android : Custom adapter fails to reload list view on activity resume

倾然丶 夕夏残阳落幕 提交于 2019-12-06 14:33:51
问题 I am trying to display received messages using custom adapter on list view , until now everything is working fine , but when I press back and come back and launch this activity again , only message send works but received messages cannot be displayed on the list view. Steps I have done so far : Use debugger to find out if message is not empty, messages are received and not empty. Use debugger inside receives() function , it turns out on first launch of activity looper.loop() function gives

Reverse the order of ListView display

穿精又带淫゛_ 提交于 2019-12-06 14:26:17
I have a SimpleCursorAdapter to retrieve information from a SQLite database and put it into a ListView. It's all textbook stuff: new SimpleCursorAdapter(this, R.layout.viewexisting, c, from, to); However, I would love for it to display the data in reverse. At the moment the oldest entry in the database appears at the top, and the newest appears at the bottom. The order of a list is dependent on how you structure your SQL Query. Specifically one that impacts this exactly is the Sort parameter inside of the SQLite query method. The last parameter is the column to sort by, depending on what this