Fwd: Filter for Custom ListView

by pawan nimje » Wed, 21 Apr 2010 18:14:48 GMT


Sponsored Links
 i,

I am having a custom listview [list with image and 2 textbox] and i
want to apply filter for it.

desc of cust listview:

1:Image i.e flag of country

2:1st textbox (name of country)

3:2nd textbox (name of continent)

so when i write " i " in a textbox [different from the ones mentioned
above] i want the list to get filtered according to country name.

My code details:

1:_________________________row.xml [each row of
list]__________________________

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dip"/>
<!-- android:src="@drawable/icon" />-->
<LinearLayout
android:orientation="vertical"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="35dip">
<TextView
android:id="@+id/toptext"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center_vertical"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:id="@+id/bottomtext"
android:singleLine="true"
android:ellipsize="marquee"
/>
</LinearLayout>
</LinearLayout>

2:__________________main.xml_____________________

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText android:id="@+id/search_box"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="type to filter"
android:inputType="text"
android:maxLines="1"/>
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<TextView
android:id="@+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/main_no_items"/>
</LinearLayout>

3:_______________________softwarepassionview.java___________________________
package com.softberries.lve;

import java.util.ArrayList;

//import com.TryFilter.R;

import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import a



Other Threads

1. Branding Android components like Button etc.

Hello There,

Basically I am developing an application which will need branding
various Android UI components/widgets with my own colours, I have been
looking for this from last few hours but there is no straight way of
doing it. Lets say I want to brand the Button component from the Java
code without any XML configuration and adding 9.png files to
resources, this is because I receive the colour for that button from a
remote server which can change from time to time(its silly but this is
a must have requirement for the project). I saw few post suggesting
having my own 9.png file that will override the originals through xml
configuration. If I have a single colour to brand with then its easy
to package the 9.png files for the various states of my button, but
the colour can be any valid RGB. So the question now; Is there any way
to get hold of the original 9.png file for any state(like button
pressed or in focussed) and clone it and then replace the RGB values
with my own? I am not sure why would Android not have such a feature.
Any suggestion or links to existing posts will be very helpful.

Thank you,
Manas.

--~--~---------~--~----~------------~-------~--~----~

2. Input keyboard and ListView onItemClick

hi,
I'm writing my first Android app. I use a ListView to load data and
onItemClick to trigger something.
But when I want to input something into the EditText located in the
top, and press the keyboard on the screen, the onItemClick will be
triggered, as the keyboard is just on the above of ListView.
This will only happen when you are not using the default input method,
for example, Google Pinyin Input Method.
I do not want the items of ListView to be clicked when the keyboard is
on the above, what should I do?

--~--~---------~--~----~------------~-------~--~----~

3. Removing SurfaceView when switching layouts

4. How to add a new library to android source

5. how to enable SkDEBUGF printf

6. Camera.takePicture and problem with Exif information

7. Virtual keypad and ListView OnItemClick conflicts