@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.edit_list_items_activity); Log.i(TAG, "Activity started!"); listNameTextView = (TextView) this.findViewById(R.id.editListName); itemRow = (TextView) this.findViewById(R.id.itemRow); empty = (TextView) this.findViewById(android.R.id.empty); relLayout = (RelativeLayout) this.findViewById(R.id.editListBg); // Pronaði i postavi ime liste. Ime liste se prenosi kao parametar u Intentu. Intent intent = getIntent(); listName = intent.getStringExtra("listName"); listNameTextView.setText(listName); // Otvori listu iz interne memorije. File file = getBaseContext().getFileStreamPath(listName); list = new List(file); // Postavi boju pozadine. int bgColor = list.getColor(); relLayout.setBackgroundColor(bgColor); // Postavi boju teksa suprotnu boji pozadine. textColor = Util.getOppositeColor(bgColor); listNameTextView.setTextColor(textColor); empty.setTextColor(textColor); registerForContextMenu(getListView()); listview_names = populateList(); et = (EditText) findViewById(R.id.EditText02); et.setTextColor(textColor); array_sort = new ArrayList<String>(Arrays.asList(listview_names)); setListAdapter(new bsAdapter(this)); lv = (ListView) findViewById(android.R.id.list); et.addTextChangedListener( new TextWatcher() { @Override public void afterTextChanged(Editable s) { // Abstract Method of TextWatcher Interface. } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Abstract Method of TextWatcher Interface. } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { textlength = et.getText().length(); array_sort.clear(); for (int i = 0; i < listview_names.length; i++) { if (textlength <= listview_names[i].length()) { if (listview_names[i] .toLowerCase() .contains(et.getText().toString().toLowerCase().trim())) { array_sort.add(listview_names[i]); } } } AppendList(array_sort); } }); lv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { String name1 = array_sort.get(position); String[] name = name1.split(","); int broj = list.idByNameInArray(name[0]); if (list.getItems().get(broj).isDone()) { list.getItems().get(broj).setDone(false); } else { list.setItemDone(broj); } String str = list.toXMLplist(); FileOutputStream fostream; try { fostream = openFileOutput(listName, Context.MODE_PRIVATE); fostream.write(str.getBytes()); fostream.close(); Util.listChanged(listName, getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } Intent intent = new Intent(getApplicationContext(), EditListItems.class); intent.putExtra("listName", listName); startActivity(intent); finish(); } }); }