Skip to main content

Posts

Showing posts from March, 2014

Android custom searchable ListView with Custom Filter

The idea is on how to implement the custom filter in a good way free of bugs. In this example i ave a list of materials and i am supposed to select from it and search inside it as well. The filter here is anonymous class inside the materials adapter. The adapter class package com.dash.util; import java.util.ArrayList; import java.util.List; import com.dash.patientmaterials.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.Filterable; import android.widget.TextView; /** * * @author melsonbati@hotmail.com * */ public class MaterialsAdapter extends ArrayAdapter<MaterialItem> implements Filterable{ private List<MaterialItem> allMaterials; private List<MaterialItem> filterdMaterials; View row; int resLayout; Context context; public MaterialsAdapter(Context context, int layoutId, L

Android Shaking View for wrong enterd password

1-create folder called  "anim" under "res" folder 2-create these two xml files under anim folde  res/anim/shake.xml   <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500" android:fromXDelta="0" android:interpolator="@anim/cycle_7" android:toXDelta="10" /> res/anim/cycle_7.xml   <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="7" /> 3- In your activity ,put these two lines of code to shake the password field Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake); findViewById(R.id.pwd).startAnimation(shake);