android-adapterview

Android ListView Duplicates entries

China☆狼群 提交于 2019-12-23 05:32:15
问题 If i type "Hello" in my edittext in activity 1 it will add "Hello" to the listview in activity 2 as the first entry ( which has no error ). Also, if I type "Apple" as my second entry I will change the first entry of "Hello" to "Apple" and add the new 2nd entry "Apple"... causing both entries to become "Apple" and "Apple"... any thoughts? Act2 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_argue_list);

Android AdapterView Click Listener Parameters - position & id

末鹿安然 提交于 2019-12-19 10:08:57
问题 I'm setting a long click listener on a listview and I want to use the index of the clicked item to retrieve the corresponding object. Method signature and parameter definition according to android docs public abstract boolean onItemLongClick (AdapterView<?> parent, View view, int position, long id) Parameters parent The AbsListView where the click happened view The view within the AbsListView that was clicked position The position of the view in the list id The row id of the item that was

How to add fixed Button in RecyclerView Adapter?

一个人想着一个人 提交于 2019-12-19 08:53:38
问题 nav_draw_row.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="true"> <TextView android:id="@+id/title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="30dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:textSize="15dp" android:textStyle="bold" android:focusable="true"

How to add fixed Button in RecyclerView Adapter?

孤街醉人 提交于 2019-12-19 08:53:08
问题 nav_draw_row.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="true"> <TextView android:id="@+id/title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="30dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:textSize="15dp" android:textStyle="bold" android:focusable="true"

Spinner: get state or get notified when opens

放肆的年华 提交于 2019-12-16 22:45:34
问题 Is it possible to know whether a Spinner is open or closed? It would even be better if there was some sort of onOpenListener for Spinners. I've tried using an OnItemSelectedListener like this: spinnerType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { executeSomething(); } @Override public void onNothingSelected(AdapterView<?> parent) { Log.d("nothing" , "selected"); } }); I

Click event from Adapter to Activity or Fragment in Android

↘锁芯ラ 提交于 2019-12-13 02:03:03
问题 I have customized expandable list view showing in Navigation Drawer. I have a click listener in Adapter I would like to send click event from adapter to my activity or fragment. Is this possible if so how do I go about doing it? Here is a snippet of my adapter: public class CustomAdapter implements ExpandableListAdapter { @Override public View getGroupView(int position, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout

Null Pointer Exception in LayoutInflator

老子叫甜甜 提交于 2019-12-13 01:14:27
问题 I am getting a Null Pointer Exception at LayoutInflator in my ExpandListAdapter class that extends BaseExpandableListAdaptor. import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.TextView; public class ExpandListAdapter extends BaseExpandableListAdapter{ private Context context; private ArrayList<ExpandListGroup> groups;

Would it be advantagous to extend android.widget.Adapter in my application?

隐身守侯 提交于 2019-12-11 23:37:05
问题 In my current application, which is for in-car use, I am displaying a series of Views (which represent gauges) at arbitrary locations within a RelativeLayout (the dashboard). There is obviously an amount of backing data that describes the positioning of those gauges, their attributes, the measurement data that they display, and so forth. At this point, it would seem sensible for me to create a separate adapter class to contain the code that translates the backing data into the appropriate

java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView

二次信任 提交于 2019-12-10 12:46:11
问题 I am using Expandable ListView example found on net Activity: public class ExpandableListViewActivity extends ExpandableListActivity { /** * strings for group elements */ static final String arrGroupelements[] = { "India", "Australia", "England", "South Africa" }; /** * strings for child elements */ static final String arrChildelements[][] = { { "Sachin Tendulkar", "Raina", "Dhoni", "Yuvi" }, { "Ponting", "Adam Gilchrist", "Michael Clarke" }, { "Andrew Strauss", "kevin Peterson", "Nasser

requestLayout() improperly called by android.widget.RelativeLayout android

余生颓废 提交于 2019-12-09 16:26:41
问题 i have implemented listview customadapter when displaying listview it showing below warring how to reslove it . requestLayout() improperly called by android.widget.RelativeLayout{b42acc20 V.E..... ......ID 0,-52-480,0 #7f0700ec app:id/ptr_id_header} during layout: running second layout pass java code public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context