android-listview

strange bug when i rotate the screen the listview inside of viewpager will disappear

[亡魂溺海] 提交于 2019-12-08 07:23:10
问题 ok I have a very strange bug! when I rotate the screen for two times the listview inside viewPager will disappear but that only happen when I change the context of viewPager which is a listView (but as I said its work ok when I rotate for the first time and its ok when I don't change the viewpager by pressing on a radioGroup): I think the problem should be either when I change the adapter inside viewpager by radio group (I mean this code): myViewpager.setAdapter(new ViewPagerAdapter(fragManag

android how to create a multiline list view

无人久伴 提交于 2019-12-08 07:17:31
问题 I am trying to create a list item which consists of two list item on above the other. The code I am using is this: package com.example.list2; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ListView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView lv1=(ListView)findViewById(R.id.listView1); Level

OnItemClick listener not working in Custom ListView

梦想的初衷 提交于 2019-12-08 06:58:31
问题 I have created a custom list view and created my own adapter class I have inflated the view with below code: @Override public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View streamrowView = layoutInflater.inflate(R.layout.streamrow, parent,false); initUI(streamrowView); tvUserMsg.setText(values[position].Message); tvPostDate.setText(values[position].postDate)

Android- Adding item to ListView from another activity onButtonClick

喜夏-厌秋 提交于 2019-12-08 06:52:53
问题 I'm not sure why my code isn't working, I've looked at the rest of the threads on this site and followed the directions but there still seems to be some error. In my app, there is a page for a user to enter some data, including dates, descriptions, hours, and minutes of duration. The description/date are Strings and hours and minutes are ints. I've focused on only the String date for now to simplify things. After the user enters this data in the activity, they will click the "Submit" button.

OnItemClickListener doesnt get called when using ViewPager in a Listview

青春壹個敷衍的年華 提交于 2019-12-08 06:17:14
问题 I have a ViewPager in a ListView . Everything works fine ( vertical scroll in list view / horizontal scroll in ViewPager ). But I am having problems catching on click event on the listview items (the viewpager fills the listview item). So far I tried set the list view to clickable extended Viewpager and added a gesture detector which detects horizontal scroll and sets requestDisallowInterceptTouchEvent(false) if the gesture is not horizontal scroll set setOnItemClickListener for my list view

ListView with custom adapter, inside a Fragment doesn't fire onItemClick event

大兔子大兔子 提交于 2019-12-08 05:59:29
问题 I have a ViewProvider class for the Fragment content, which returns a ListView for one of the fragments. The ListView has a custom adapter extending the BaseAdapter class. When I try implement an item click listener, it just doesn't work. I have this code for the listener: lv.setOnItemClickListener(new ListView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> a, View vi, int pos, long id) { try { Object o = lv.getItemAtPosition(pos); Event obj_itemDetails = (Event) o;

How to set Filter to ListView with CursorAdapter?

不问归期 提交于 2019-12-08 05:45:55
问题 I have a ListView . which of it's items are from custom CursorAdapter . I have created separate layout for ListView items which is a CardView . I have six TextViews on each card they are Database values. Now i have to put a EditText to filter the ListView items according to the text entered in EditText. My Code is layout with ListView is <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout

Checking RadioButton of RadioGroup in ListView checks other item button

旧巷老猫 提交于 2019-12-08 05:42:10
问题 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 =

ListView repeated CheckBox behavior every 10th item erratically

こ雲淡風輕ζ 提交于 2019-12-08 05:33:47
问题 I have a ListView that is filled by a CustomAdapter with a specific Layout. An ArrayList is passed as a parameter to this CustomAdapter, which contains the data for each ListView element. Each ListView element is composed by a TextView (where I display the data from the ArrayList) and a CheckBox at the right of it. The data in the ArrayList is correct. This data is also correctly shown when the ListView is filled and it's not repeated in any element (see images below for details). The issue:

Get the total count of number of rows in the Custom Listview Android

浪子不回头ぞ 提交于 2019-12-08 04:53:01
问题 I am trying to getting the total Count of the getView custom listview. But want to display in the different layout. Here is my onCreatedView. I am not sure how to inflate the layout. Thanks for all your help. private static ListView addDropListView = null; private TransactionAddDropAdapter addDropAdapter = null; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { fragmentPendingTrades = inflater.inflate(R.layout.fragment_transactions_pending,