Filter for Custom ListView

by pawan nimje » Wed, 21 Apr 2010 05:05:25 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;



Other Threads

1. How do you overlay a TextView on top of a Camera SurviceView?

How do you overlay a TextView on top of a Camera SurviceView?  Thanks
in advance.
--~--~---------~--~----~------------~-------~--~----~

2. Background Image for a (semi-transparent) List

Hi fellows,

first of all, please don't hit me for asking stupid question. :) I'm
quite a novice when it comes to Java (J2EE, J2ME, J2SE), but I'm a
totally n00b when it comes to android. The tutorials are very helpful
although I needed several tries to get a ListActivity working (using a
ListAdapter)... my approach to just display an array of Strings didn't
work... That should have been the easiest solution, since I have a
fixed number of items to display in the list...

This is what I did:

private String[] someStringArrayThatShouldWork = {"Test1", "Test2"};

in the onCreate method:

setListAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1,
someStringArrayThatShouldWork));
getListView().setTextFilterEnabled(true);

I received an exception whenever I wanted to start the app. Is there
anything else I need? That exception was something like "need ID for
TextView" or something...

But basically I'd like to have something like that:

A list, which is semi-transparent printed on a background image! That
background image should change when ever the device is rotated to it's
widescreen "outfit". You should see the background image and also the
list entrie about it. (65% opacity)

Can someone give me some hints where to start... I've already checked
the API demos... But I didn't even get the simple List (String Array
example) to work... :)

Regards and thank you very much in advance,

Sascha

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

3. how to get the data from app.Service

4. Teaching Android

5. Button added to XML layout, it crashes!

6. Spinner Text / Value

7. Booleans crash my SQLite INSERT...