android-listview

List item layout containing a CheckBox doesn't work as expected

北慕城南 提交于 2019-12-12 04:51:51
问题 I have a ListView whose layout contains a CheckBox . I want both the CheckBox to be active, and list items themselves to be tappable. It doesn't work. Yes, I know about the typical solution (setting focusable to false on the CheckBox so that it doesn't steal focus). It doesn't help. Here's the layout of my list item: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/rl_container" android:layout_width=

Nullpointer exception when trying to access to ListView 's children

不想你离开。 提交于 2019-12-12 04:49:19
问题 I've created a Listfragment, which displays a List of views . Here is the ListFragment : public class AroundYou extends ListFragment { private int[] images = new int[] { R.drawable.pinguin, R.drawable.pinguin, R.drawable.pinguin, R.drawable.pinguin, R.drawable.pinguin, R.drawable.pinguin, R.drawable.pinguin, R.drawable.pinguin, R.drawable.pinguin, R.drawable.pinguin }; private String[] names = new String[] { "Pingu", "Pingu", "Pingu", "Pingu", "Pingu", "Pingu", "Pingu", "Pingu", "Pingu",

how to store check box value from one activity to another activity

青春壹個敷衍的年華 提交于 2019-12-12 04:45:00
问题 i have two activity with checkboxs in a list and i have to pass each value of checkbox to another activity and make it checked, where i can't use intent to pass that because both activity is not next together. In this case how i will store the values in an array and to retrive in another activity thanks to all, i have done it now and i'm posting it. int i = 0; checkBox = new CheckBox[getItemPR.size()]; Constants.INDEX_TEMP_NEW=new int[getItemPR.size()];// stoing in array[] while (i <

Surfaceview in listview scrolling issue

我只是一个虾纸丫 提交于 2019-12-12 04:44:04
问题 i have a question for you.I'm developing a control based on a surfaceview which i called it "graph".In this control i draw a path (imagine a sinusoidal function).This control works fine.Now i want that my application would be able to show multiple instances of this graph control.I was thinking to use a listview control to contain them.I implemented it,but i have a problem when i scroll it.It seems that the adiacent graph items in the listview overlaps each other as it was non correctly

“new ArrayAdapter<String>(this ” error when used in dialog null exception

懵懂的女人 提交于 2019-12-12 04:42:44
问题 hi, I have been working on a dialog box and i need a ListView inside the dialog box. The problem is i cant use "this" "new ArrayAdapter(this" Can someone help me? ListView dialog_ListView = (ListView)dialog.findViewById(R.id.list); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, comment11); dialog_ListView.setAdapter(adapter); 回答1: Maybe this workaround helps you: ListView dialog_ListView = (ListView)dialog.findViewById(R.id.list);

MediaPlayer inside ViewPager Fragment

↘锁芯ラ 提交于 2019-12-12 04:36:14
问题 I am using the below code for viewpage inside listview. ViewPager viewPager = (ViewPager) currentView.findViewById(R.id.pager); viewPager.setId(position + 1); viewPager.setPageMargin(30); ViewPagerAdapter tempMyFriendPagerAdapter = new ViewPagerAdapter(mFragmentManager, mItems.get(position).getViewPagerItems()); viewPager.setAdapter(tempMyFriendPagerAdapter); Code taken from https://dl.dropboxusercontent.com/u/20178650/builds/listviewwithviewpager.zip Now say I scroll the listview fast to the

Get the position in a ListView of a Spinner and get its selected value

本秂侑毒 提交于 2019-12-12 04:34:10
问题 I implemented an ArrayAdapter for my ListView : public class CalcAMRListAdapter extends ArrayAdapter<AMRStateListEntry> implements OnItemSelectedListener { public CalcAMRListAdapter(Context context, List<AMRStateListEntry> entries) { super(context, R.layout.activity_calc_amr_fragment_row, entries); } @Override public View getView(int position, View convertView, ViewGroup parent) { AMRStateListEntry entry = this.getItem(position); ViewHolder viewHolder = null; LayoutInflater inflater = null;

How to prevent lifting listview when keyboard goes up

回眸只為那壹抹淺笑 提交于 2019-12-12 04:12:12
问题 This is code MainActivity java and main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_layout" android:gravity="center" android:layout_height="match_parent" android:layout_width="match_parent" android:background="#75F575"> <LinearLayout android:clickable="true" android:layout_gravity="center" android:orientation="vertical" android:layout_width="250dp" android:layout_height="100dp" android:background="#C69817" android:id="@+id/secondLayout">

Android JSONObject to ListView

主宰稳场 提交于 2019-12-12 04:10:14
问题 I'm having a problem here, I'm totally new at this. What i try to do is pass a JSONObject to my adapter and inside my adapter create all rows for that ListView This is my code: private static final String TAG_OS = "android"; protected void onPostExecute(JSONObject json) { try { JSONArray jArray = json.getJSONArray(TAG_OS); if (jArray != null) { for (int i=0;i<jArray.length();i++){ listdata.add(jArray.get(i).toString()); } } menu_list=(ListView)findViewById(R.id.menu_list); MenuAdapter adapter

Scroll to end in a PullToRefreshListView

◇◆丶佛笑我妖孽 提交于 2019-12-12 04:08:49
问题 How do I programmatically upon inserting new items to a PullToRefreshListView scroll so that the last item is visible? Here is some code: listView = (PullToRefreshListView) findViewById(R.id.list); listView.setAdapter(someAdapter); And I would like to do: listView.scrollToEnd(); or someAdapter.scrollToEnd(); or something similar. 回答1: You can set the TranscriptMode on a ListView to have it always scroll to the bottom when new content is added listView.setTranscriptMode(ListView.TRANSCRIPT