Edited Answer
Apply this example. Please, this works for you. I tested this code
//ListviewActivity.java
package com.anl.lk; public class ListviewActivity extends ListActivity { static final String[] COUNTRIES = new String[] { "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory" }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter < String > (this, android.R.layout.simple_list_item_1, COUNTRIES)); getListView().setTextFilterEnabled(true); } @Override protected void onListItemClick(ListView l, View v, int position, long id) {
// FirstPage
package com.anl.lk; public class FirstPage extends Activity { @override protected void onCreate(Bundle savedInstanceState) {
// manifest file
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.anl.lk" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:label="@string/app_name" android:name=".FirstPage" > <intent-filter > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".ListviewActivity" android:theme="@android:style/Theme.Dialog"></activity> </application>
Please use this code, you have a solution