0

the Action bar is not visible after adding ListView, could you please tell me you to make it visible again?in addition how to create SearchView in this java file?

MainActivity.java

public class MainActivity extends ListActivity {

    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        // 1. pass context and data to the custom adapter
        MyAdapter adapter = new MyAdapter(this, generateData());

        //2. setListAdapter
        setListAdapter(adapter);
    }

    private ArrayList<Item> generateData(){
        ArrayList<Item> items = new ArrayList<Item>();
        items.add(new Item("item1","description1"));
        items.add(new Item("item2", "description2"));
        items.add(new Item("item3", "description3"));

        return items;

    }
}
abood250
  • 3
  • 1
  • 5
  • There was a post in another section you might find interesting. [ http://stackoverflow.com/questions/17919933/action-bar-do-not-show-in-android ][1] Will show you about getting g the action bar up :) – SmiffyKmc Oct 25 '15 at 19:08
  • I need to searchview widget please not for action bar,Actually I tried to add one but won't appear because the listview android:layout_width="fill_parent" android:layout_height="wrap_content" and the SerchView android:layout_width="wrap_content" android:layout_height="wrap_content" and the layout is RelativeLayout – abood250 Oct 25 '15 at 19:41

1 Answers1

0

i think that you should use AppCompatActivity with listview insted of ListActivity

Omar Mahmoud
  • 2,902
  • 1
  • 14
  • 22