android,android-layout,listview,android-listview
Okay so I used two different layouts that are identical. One for the footer (when the listview does not populate the entire screen) and one for the bottom view(when the listview is larger than the screen). Keep in mind that they are two different views but identical. That means you...
android,android-listview,menuitem,contextual-action-bar,android-contextmenu
Multiple selection not exist Selected items (rows) not colored to indicate they are selected Presumably, you are not setting up the activated style for your list rows, which governs both of these. How to change... color of the CAB A custom theme should be able to do it. The...
android,android-listview,android-listfragment,notifydatasetchanged
The problem is that you are setting your data source to a new reference inside the Adapter by calling this.allData=new ArrayList<SparseArray<String>>(); Once you initialize the allData list, and set it as the data source for the Adapter, you must never change the reference to a new list. There is no...
If holder.b1 button text is changing then the reason is you are not handling your getView properly. I guess this returns some Integer id list.get(position).Rno So you need to store that id in some arraylist for example //Declare this outside of getView(). ArrayList<Integer> your_number = new ArrayList(); And in your...
java,android,android-fragments,android-listview,android-listfragment
The main problem why the fragment is not showing upon poping the backstack is that you are trying to inflate that fragment in another fragments id which is this part of the code: transaction.replace(R.id.master_container, newFragment); You don't need a whole new activity just to host another fragment which you did...
java,android,xml,android-listview,android-listfragment
Please move the logic to add fragment inside the if loop you have.
android,json,android-listview,android-arrayadapter,listadapter
Volley Library makes this work quite easy and handles all other related tasks itself. You can use ImageLoader or NetworkImageView.Follow the link for how to acheive it: https://developer.android.com/training/volley/request.html
java,android,listview,android-listview
Thanks to Daniel Nugent's suggestion I got it working. Removing the convertView.setOnClickListener() is part of the answer. I think it was blocking the other listeners in the HotelOverviewFragment. My next mistake was that I used setOnClickListener on a ListView for testing. setOnClickListener should be used for buttons not ListViews. So...
android,android-layout,android-activity,layout,android-listview
Your problem is with your RelativeLayout under your ScrollView. Try replacing it with a vertical LinearLayout and give its 2 child LinearLayout a weight of 1 like this: <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" > <LinearLayout android:id="@+id/LinearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/ll" android:layout_width="fill_parent"...
java,android,xml,android-fragments,android-listview
Change your ListView width to match parent. That way the list item will be a full row.
android,listview,android-listview
I think what you're looking for is a Custom ListView. It is basically a listView but you provide your own row layout (therefore, giving you better control on how many columns of data you want to display), as well as your own BaseAdapter class. Here's an example. First you need...
You need to use OnItemLongClickListener(), like this: lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this); alert.setTitle("Service") .setMessage("Add to favorite?") //.setIcon(R.drawable.chile1) .setPositiveButton("Si", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = new...
android,android-listview,android-search
Try to change your listener // listening to single list item on click lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // getting values from selected ListItem vo value je sprava String prodname = ((TextView) view.findViewById(R.id.product_name)).getText().toString(); if( prodname.equals("Apple") { //code specific to first list...
android,android-listview,navigation-drawer,baseadapter
You are always calling displayView() with the selected index position in the list of NavDrawerItems. In the case where the user is logged out, there are only 2 items in the list. When the user chooses "login", the index position is 1, not 5. You probably want to add one...
java,android,listview,android-listview,onclicklistener
To start a new Activity you have to use intents : Intent intent = new Intent(this, MySecondActivity.class); You can add extras : intent.putExtra(EXTRA_MESSAGE, message); And to start the activity : startActivity(intent); Now if you wan to do it when you click on an item of your list you'll have to...
android,android-layout,android-listview
Please refer to this http://developer.android.com/training/improving-layouts/index.html There are some good ways to improve in your case, such as: Optimizing Layout Hierarchies Re-using Layouts with Loading Views On Demand Have fun....
android,for-loop,android-listview,android-edittext,android-linearlayout
The problem is that the ArrayAdapter will call getView() each time the row becomes visible. If the row has been set up previously, it will pass in the previously set up View in the convertView parameter. See here for details. From the documentation for convertView: The old view to reuse,...
java,android,android-listview,nullpointerexception,android-arrayadapter
Your context is null. Use MainActivity.this for a context in an anon inner class of your activity.
java,android,android-fragments,android-listview,notifydatasetchanged
Just make it visible for the entire Activity. ... MyClass { private MyArrayAdapter adapter; @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); String[] names = new String[] { "name1", "name1", "name1" }; String[] values = new String[] { "value1", "value2", "value3" }; adapter = new MyArrayAdapter(getActivity(), names, values); setListAdapter(adapter); } //...
android,android-listview,android-asynctask,adapter
Please create a list to store current AsyncTask, then cancel it anytime you want for (AsyncTask myAsyncTask : myAsyncTasks) { if (myAsyncTask.getStatus().equals(AsyncTask.Status.RUNNING)) { myAsyncTask.cancel(true); } } myAsyncTasks.clear(); Detail for your code: private List<AsyncTask> myAsyncTasks = new ArrayList<>(); public void addRunningTask(AsyncTask task) { myAsyncTasks.add(task); } public void cancelRunningTasks() { for (AsyncTask...
java,android,listview,android-listview,nullpointerexception
You already know where the problem is! tv.setText(question.toString()+""); is causing the NPE that means the TextView tv is null. And that means that the line TextView tv = (TextView) view.findViewById(R.id.question_list_item_string); is not able to find the TextView. Check the question_list_item_string id and make sure it matches the id in your...
android,listview,android-listview,android-cursoradapter
Instead of creating a new Adapter every time your list got clicked (which caused the list to scroll back to top) you could utilize a SparseBooleanArray to keep track on what items is currently in selection. In your adapter: public class YourAdapter extends CursorAdapter { // Initialize the array SparseBooleanArray...
android,listview,android-listview
Created a reference integer in the static ViewHolder that holds the position of clicked item in listview. Then in text watcher i set the string of the item that exists in the viewholder.reference position of my list. So, static is helping with that job. The following code is the one...
android,listview,checkbox,android-listview
The way the ListView works is that it recycles the same views populated with different data. Hence, the need for the view holder pattern, which it looks like you are using. So, in order for your list to work correctly, you need to save the checked state to your backing...
The padding is due to the padding provided to RelativeLayout From your XML code remove padding by making you code look like <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <ListView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/listView" android:layout_alignParentTop="true"...
You are not setting the data when convert view is null. Which it would be in the first few passes. You only set it in the else condition. One quick fix would be to set the convert view to the view that you are creating instead of returning it at...
android,android-layout,android-listview
I hope this will work for u : <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:id ="@+id/mainFilterLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView...
android,android-listview,android-5.0-lollipop
Aren't the list items children of the ListView? Yes, when the ListView creates them via the associated ListAdapter. The empty view is not a list item. It is not a child of the ListView. It is simply another view. AdapterView toggles the visibility of itself and the empty view,...
android,android-listview,android-adapter
You'll need to improve your ArrayAdapter. Currently you're not setting the data to the TextView. Try the following, I didn't test it but it should work. public class CategoryAdapter extends ArrayAdapter { private LayoutInflater inflater; public CategoryAdapter(Activity activity, ArrayList<Category> items){ super(activity, R.layout.row_category, items); inflater = activity.getWindow().getLayoutInflater(); } @Override public View...
android,android-layout,android-listview,android-adapter
I think this is because of your layout file. Change the android:layout_height=wrap_content of your ListView tag to android:layout_height=match_parent.
android,android-activity,android-listview
It is a simple change of declaring MyListAdapter in your MainActivity and instantiate it once in the populateListView, public class MainActivity extends Activity { private List<Assignment> allDeliveries= new ArrayList<Assignment>(); MyListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); populateDeliveryList(); populateListView(); registerClickCallBack(); final MySQLiteHelper db = new MySQLiteHelper(this);...
java,android,listview,android-listview
Firstly, you should not be doing todoTextView.setText(values.get(0)); Because this will always return the first element of the values list. You should do todoTextView.setText(values.get(position)); Secondly, mAdapter.values.add(toDo); is not really right. It will work, but its not the best practise. Try using something like mAdapter.add(toDo); or values.add(toDo); Now once you've added the...
You didn't initialize your LayoutInflater in your Adapter. You can initialize it in your constructor of your adapter like that: public ImageListAdaptor(ArrayList<ListItem> some, Context context) { items = some; inf = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } And when you are creating your adapter in your activity: myAdd = new ImageListAdaptor(items, this); ...
android,listview,android-listview,imageview
ok i found a workaround by referencing the private LinkedList<Entity> entity; public AuthorsAdapter(Context context, LinkedList<Entity> entity) { super(context, 0, entity); this.entity = entity; } in the constructor then instead of doing like you said : .... else{ holder = (ViewHolder) convertView.getTag(); } if (!getItem(position).isImageResized()) { holder.imageViewPicture.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));...
android,listview,android-listview,android-sqlite
Instead of using String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + " display_name like %"+constraint.toString()+"%"; use String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + " and display_name like '%"+constraint.toString()+"%'"; this may solve the problem...
java,android,listview,android-listview,android-arrayadapter
inflate() returns the root layout of your XML view hierarchy. Assuming the root view has the id rowbackground, this line holder.rw.setTag(menuLinkList.get(position).getId()); overwrites the viewholder tag with a String and recycling the view won't work. You can store additional data such as an id in a view holder field, no need...
android,listview,android-listview,baseadapter,swiperefreshlayout
In onCreateView(), it is not returning the root view, it is returning null because the class member v is null initially and is not modified. The existing code, change FROM: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (v == null) { View v = inflater... }...
I have one way Create refresh method in your Adapter like public void refresh(ArrayList<Aviso> itemsw) { this.items = itemsw; notifyDataSetChanged(); } Now you just called this method from your Activity Aviso aviso = new Aviso(); aviso.setTitle("MMMMMMMMMMMMMMMMMMMMMM"); aviso.setDescription("Deskribapena"); aviso.setPubDate("Wed, 19 Mar 2016 12:40:00 GMT"); aviso.setDcDate("2016-03-19T12:40:00Z"); avisosList.add(aviso); adapter.refresh(avisosList); EDIT: To add the...
android,xml,listview,android-listview
You need to set the Gravity to CENTER programatically on that particular element to center it in your Adapter's getView() method. If you use the ViewHolder pattern, make sure you set the other ones to default; so you'll need an if/else statement.
java,android,android-listview,parameterized-types
As you might have seen if you try new AdapterView<SquirrelAdapter>.OnItemClickListener() compiler would say, The member type AdapterView<SquirrelAdapter>.OnItemClickListener cannot be qualified with a parameterized type, since it is static. What you are doing inside listView.setOnItemClickListener is to create an Anonymous class, for an interface OnItemClickListener inside abstract class AdapterView. Now, to...
java,android,listview,android-listview,listviewitem
If you want to click entire row, just implement OnClickListener. If you want to click entire row and links inside the row (which i thing this is what you want): You have to create a custom row item Create an interface Send that interface listener to the adapter Check if...
android,listview,android-listview
You can use this for disabling the parent scrollview parentview.requestDisallowInterceptTouchEvent(true); if the overlay is visible ....
java,android,arrays,android-listview,android-listfragment
your getData expects a String[] and your are providing a matrix on int. You should change its signature, in order to accept an int[][] or better an int[]. If you don't want to change your adapter, let getData, convert the resource's id to String. E.g public List<String> getData(int[] res) {...
android,android-activity,android-listview,android-database
This exception, ClassCastException, says that you have done an invalid class casting. lugar.setPosicion((GeoPuntoAlt) new GeoPunto(cursor.getDouble(3), cursor.getDouble(4))); In this line, you have casted output of new GeoPunto(...) to GeoPuntoAlt. Make sure this casting is valid....
android,listview,android-listview
Found a great library which does what I was looking to do!! https://github.com/timroes/SwipeToDismissUndoList...
android,android-listview,chat,android-recyclerview
It can be done with recyclerview. Here is what I did for displaying multiple types of rows in a single recyclerview // Different types of rows private static final int TYPE_ITEM1 = 0; private static final int TYPE_ITEM2 = 1; public class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { class ViewHolder0 extends RecyclerView.ViewHolder...
android,xml,android-layout,android-fragments,android-listview
I'm guessing the issue is that the ListView doesn't show up. This is most likely because you're not returning the view that you're inflating and manipulating. You inflate the first view, and find the listview on that, and set the adapter (which is all correct), but then you inflate a...
android,android-layout,android-listview
Remove the static specifiers of the ViewHolder Try replacing this private static class ViewHolder { private static TextView tv_Title, tv_Price, tv_SellingPrice, tv_ShippingCharge, tv_TotalPrice; private static ImageView iv_Cancel, iv_ProductImage; } with private static class ViewHolder { private TextView tv_Title, tv_Price, tv_SellingPrice, tv_ShippingCharge, tv_TotalPrice; private ImageView iv_Cancel, iv_ProductImage; } ...
android,android-listview,menu,contextmenu,android-toolbar
Check this official android guide. EDIT: Using the contextual action mode For views that provide contextual actions, you should usually invoke the contextual action mode upon one of two events (or both): The user performs a long-click on the view. The user selects a checkbox or similar UI component within...
android,json,listview,dynamic,android-listview
Write a method in your adapter to add new items in existing list of items. and call that method in your async task when you are getting new dataset from your services/APIs.. Do not forget to put notifyDataSetChanged() in that method inside adapter.
java,android,listview,android-listview
constructor MyColoringAdapter in class MainActivity.MyColoringAdapter cannot be applied to given types; required: Context,String[] found: MainActivity,ArrayList reason: actual argument ArrayList cannot be converted to String[] by method invocation conversion the problem is the Constructor of your ArrayAdpater. It takes a String[] but in your Activity you are passing an ArrayList<String>...
java,android,android-fragments,android-listview,swiperefreshlayout
Your recent_list is null and you are referencing it outside the onCreateView inside your RecentsCardFragment, this is why the NullPointerException happenning. Move your recent_list declaration into your onCreateView method, like this: public class RecentsCardFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener { ListView recentsList; private SwipeRefreshLayout refreshBooks; ArrayList<HashMap<String,String>> items = new ArrayList<>(); //private...
android,listview,animation,android-listview,adapter
Thanks to the response of CommonsWare I used RecyclerView and it's much simpler animating the insertion and removal of items.
android,listview,android-listview
A solution to my problem was found by creating in the @drawable folder: 1) "NOT Clicked" Background layout to the ListView item named not_clicked_layout.xml like: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <stroke android:width="1.5dp" android:color="#000000" /> <solid android:color="@color/green"/> <padding android:left="7dp" android:top="7dp" android:right="7dp" android:bottom="0dp" /> <corners android:radius="4dp"/> </shape> 2)...
android,android-listview,listviewitem,onscroll
Whenever loading the listview you need to consider all the scenario. What i mean was if you are setting text for textview using if condition you must write else condition and need to write action for that textview. If you don't consider else part then you got that issue. When...
android,android-listview,youtube-api,player
This can be done in different ways. You can use a simple WebView to load those videos. You can also use the official "YouTube Android Player API" YouTube Android Player API Implementing Youtube's API is easy, First create a YouTubePlayerViewin your xml, <com.google.android.youtube.player.YouTubePlayerView android:id="@+id/youtubeplayerview" android:layout_width="match_parent" android:layout_height="wrap_content"/> Then show a video...
android,android-listview,android-view,android-view-invalidate
The behavior is expected only. Calling invalidate() of any view will just re-draw the content what is there already, it will not update unless the change is in the canvas. When you change the language, the footerView is not notified, so that it can change the content. So when you...
What you have to do is to make a Custom ListView with your own row_layout.xml file, a CustomListViewObject that has a boolean to check if the element is clicked or not, and lastly, a CustomListView to check if the row element is selected or not. Your row layout row_layout.xml: <?xml...
java,android,listview,android-listview
Sorry I didn't get back to you sooner but I was busy. Don't use a hashmap to store the Bitmaps. It's over complicating things. ArrayList<Bitmap> list2 = new ArrayList<>(); then change this line.. Bitmap Imageback = list2.get(position).get(R.id.index); to this Bitmap ImageBack = list2.get(position); The reason why what you wrote didn't...
Actually, when I added more test data it started working. Would appear that if your search results are small (I was using about 20 or so) it doesn't kick in. Once I added some dummy data of about 100 or so then it started working.
android,android-listview,android-seekbar
Create a custom list adapter with BaseAdapter or ArrayAdapter. Attach adapter to ListView In getView() method of adapter get the reference of seekbar and set the listener to seekbar like this: final TextView text=convertView.findViewById(R.id.textview); final SeekBar seekbar=(SeekBar) convertView.findViewById(R.id.seekBar1); sk.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated...
android,json,listview,android-listview
Exception is thrown here: String id = c.getString("idPatient"); There is no "idPatient" key in your JSON. Try to replace it with just "id"...
android,android-listview,android-volley,networkimageview
Try like this in else block else { thumbnail.setVisibility(View.VISIBLE);//add this thumbnail.setImageUrl(newsArticlesItems.get(postion).getThumbnailUrl(), imageLoader); } ...
android,android-layout,android-activity,android-listview,android-arrayadapter
I would recommend to use an ArrayList instead of a String[] in your Adapter class. It makes it a lot easier to delete or edit a View and the associated data behind it. I used this post to convert your String[] to an ArrayList, delete the item and convert back...
android,listview,checkbox,android-listview
I think the following two things should help you in making the checkboxes clickable ->> Add android:descendantFocusability="blocksDescendants" in the parent ViewGroup of todo_list layout ->> Add android:clickable="true" in your todo_CheckBox view's definition Once, you can start seeing the checkboxes clicking on the screen, as user370305 rightly mentioned checks on the...
android,arrays,listview,android-listview,parse.com
If i understood, this is one way of do this: SharedPreferences settings = getSharedPreferences("NotificationIDs", Context.MODE_PRIVATE); Set<String> myStrings = settings.getStringSet("myStrings", new HashSet<String>()); List<ParseObject> users = new ArrayList<>(); final ListView idList; idList = (ListView) findViewById(android.R.id.list); final ArrayAdapter<String> str = new ArrayAdapter<>(getBaseContext(), android.R.layout.simple_list_item_1, new ArrayList<String>()); idList.setAdapter(str);...
java,android,listview,android-listview,android-studio
Please remove } after setContentView and put new } at the end of code @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String[] myArray = {"biscuits", "laptops", "mice", "headphones", "macBook", "bottles", "something", "also something", "this list is stupid", "and", "dumb", "and", "useless", "okay", "here it ends"}; ListAdapter myListAdapter = new...
android,listview,android-listview
Root cause here: Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 Your table in database is empty (as the result, the cursor is empty), but you are trying to get something in it. The solution is always check cursor.moveToFirst() before you query anything. if (cursor != null...
android,listview,android-fragments,android-listview
onCreate is called before onCreateView, therefore the fragments layout is not yet inflated there. You need to move your code that deals with the fragment's layout to onCreateView where all the inflation happens: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_list, container, false); String[]...
android,listview,android-activity,android-listview,listactivity
MD already provided the ans for moving one list activity to second list activity. Just need to add dot(.) like Class ourClass = Class.forName("adnan.com.ufone." + whichItemClicked); For header problem follow This Tutorial this may help you. This tutorial fix the header and footer for all activities....
android,android-listview,android-studio
It will expand your listview as per your row height and width dynamically. public static void getTotalHeightofListView(ListView listView) { ListAdapter mAdapter = listView.getAdapter(); int totalHeight = 0; for (int i = 0; i < mAdapter.getCount(); i++) { View mView = mAdapter.getView(i, null, listView); mView.measure( View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); totalHeight +=...
android,listview,android-listview,android-adapter
I got it working by using HashMap as SAM suggested. Here is what I did. in Adapter class HashMap<Long, String> map = new HashMap<Long, String>(); in getView()method of adapter if(post.postlikeflag==0){ map.put(post.postid, "like"); } else{ map.put(post.postid,"liked"); } if(map.get(post.postid).equals("like")) { holder.like.setBackgroundResource(R.drawable.like); } else { holder.like.setBackgroundResource(R.drawable.liked); } And in onclickListener of like button...
android,android-listview,swiperefreshlayout
I solved same problem by using FrameLayout, look at below code: <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/layout_swipe_refresh" android:layout_width="match_parent" android:layout_height="wrap_content"> <ListView android:id="@+id/lv_products" android:layout_width="fill_parent" android:layout_height="wrap_content" android:divider="@null" /> </android.support.v4.widget.SwipeRefreshLayout>...
android,android-layout,android-listview
Finally (with the help of a friend) I found all answers. The code works across many versions. This ends a long search, I hope this is of help for you! Answer 1: nice custom layout of your list items. Customshape and customshape_pressed. Change them, this is just an example. Answer...
android,android-listview,multichoiceitems
Just make custom layout - simple_list_item_multiple_choice.xml like this - <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:textAppearance="?android:attr/textAppearanceLarge" android:gravity="center_vertical" android:checkMark="?android:attr/listChoiceIndicatorMultiple" android:paddingLeft="6dip" android:paddingRight="6dip" android:textColor="#FF0000"...
android,android-listview,onitemclick
In the type of TYPE_ITEM_AMOUNTS,you set the view to be disabled,and OnClickListener null,so it's not clickable,I guess this is exactly what you want; In the type of TYPE_ITEM_LIMITS,you have a Switch here,but you don't set a OnCheckedChangeListener for the switch. When you using a OnItemClickListener for a ListView,remember this:If there...
android,listview,android-listview
When it's not selected you have to set a transparent/default color otherwise it will make items red after you make one item red. if(jamList.get(position).isSelected()) { convertView.setBackgroundColor(convertView.getContext().getResources().getColor(R.color.transparent_red)); } else{ convertView.setBackgroundColor(convertView.getContext().getResources().getColor(android.R.color.transparent)); } ...
android,android-layout,listview,android-listview
The reason it is asking for android:id="@id/android:list" is because you are extending your Fragment with ListFragment, read the documentation here ListFragment Documentation you can simply extend your Fragment class with Fragment instead of ListFragment....
android,android-listview,listadapter
Change the code in onTextChanged() method to afterTextChanged() method as below: @Override public void afterTextChanged(Editable s) { String str=s.toString(); getSearchItems(str); } In getSearchItems use the filter properly. I used other way to filter as, public void getSearchItems(String searchText){ List<Employee> searchList=new ArrayList<Employee>(); List<Employee> employeeList=getEmployeeList(); if(employeeList2!=null){ for(Employee e:employeeList){ if(e.name.toLowerCase().contains(searchText.toLowerCase())){...
android,android-listview,material-design
Scrollbar thumb color is set to the android:colorAccent attribute in your app theme. You are sure that is set and is correct, right? Note that if you're using AppCompat, you will have to exclude the android: prefix from the attribute. You can find more information on available color attributes here....
android,android-fragments,android-listview
The error message says: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead The OnClickListener is meant for click events on whole views. In an AdapterView, you usually want to register click events for each item separately. For this you need to use OnItemClickListener....
java,android,android-listview,android-adapter
In getView() after setting the text update the visibility of the textview to Visible, since listitems in the ListView will get recycled. holder.tv1.setText(getItem(position)); holder.tv2.setText(getItem(position)); holder.tv1.setVisibility(View.VISIBLE); //Your code..... Updated : public class CustomAdapter extends BaseAdapter { private ArrayList list = new ArrayList(); private Context context; public CustomAdapter(Context context) { this.context =...
android,listview,android-listview
Try to declare position as final in getView() : public View getView(final int position, View convertView, ViewGroup parent) { ...
android,android-activity,android-listview,navigation-drawer,rippledrawable
You can control the colour of the RippleDrawable by doing the following: RippleDrawable rippleDrawable = (RippleDrawable)view.getBackground(); // assumes bg is a RippleDrawable int[][] states = new int[][] { new int[] { android.R.attr.state_enabled} }; int[] colors = new int[] { Color.BLUE }; // sets the ripple color to blue ColorStateList colorStateList...
android,android-intent,android-listview,broadcastreceiver
You have declared your PhonecallReceiver as abstract. This means that Android cannot instantiate it when it needs to. You need to rethink your architecture. BroadcastReceivers declared in the manifest cannot be abstract because Android needs to be able to instantiate them itself as needed. Either make your PhonecallReceiver concrete (not...
java,android,android-fragments,android-listview,android-listfragment
it is because R.string.america is an integer which represent a string inside strings.xml. So you should change the type for String[][] to int[][]. If you have to assign the value to a TextVIew android will take care of the look up in strings.xml.
java,android,listview,android-listview
I think you'd better let the server do the sequencing,using "order by" in SQL selecting. If you do the sequencing in android app, once something changed in your database,or business logic improved,you have to rewrite your sequencing codes in app,and let all your users update there app.You can change the...
android,listview,android-listview,android-arrayadapter,popupmenu
You Should re-populate the folderlist then call Notifydatasetchanged. fileNames = fileFunctions.listFileNames(Environment.getExternalStorageDirectory() + "/Documents/Files"); for(int i = 0; i < fileNames.length; i++){ folderList.add(new FolderBean(fileNames[i], "text")); } ...
android,android-layout,listview,android-fragments,android-listview
listItem = layoutInflater.inflate(R.layout.news_item_layout, parent, false); You're currently setting your row's root elements to null, which will cause your layout_xx attributes to be ignored http://possiblemobile.com/2013/05/layout-inflation-as-intended/...
android,listview,android-listview,view
this line inside your click listener is the issue: viewHolder = (ViewHolder) view.getTag(); the view received during click is the actual clicked view, meaning on the call onClick(View v) for the case R.id.edit_imagebutton the View v is the ImageButton editIB . So when you ask for the tag of it,...
android-layout,android-listview,recyclerview,android-4.1-jelly-bean
Finally found the solution! The problem lays in the layout XML file: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_item_doc" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:attr/selectableItemBackground" android:padding="12dp"> The background attribute apparenly isn't valid for Jelly Bean devices. Changing the value from android:background="?android:attr/selectableItemBackground" to...
android,listview,android-listview,sharedpreferences
count = pred.getInt("countd",count); if(count > 0){ for(int i = 0; i < count; i++){ arrayCars.add(new Car(pred.getString("Value["+i+"]", ""),"green",3455)); count++; } } In the above code you are increasing count by 1 each time so it never ends loop will repeat untill it throw exception. To avoid delete that count++; Hope this...
android,android-listview,android-support-library,android-recyclerview
The only solution to make it work now is to use this: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { listView.setNestedScrollingEnabled(true); } It will obviously only work on Lollipop....