protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.manage_feeds);
final SharedPreferences prefs = getSharedPreferences(MY_PREFERENCES,
final Map<String, ?> map = prefs.getAll();
final SharedPreferences.Editor editor = prefs.edit();
final EditText et = (EditText) findViewById(R.id.add_key);
final ListView listView = (ListView) findViewById(R.id.feed_keyword_list);
Button updateButton = (Button) findViewById(R.id.add_key_button);
updateButton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
String key_to_add = (String) et.getText().toString();
if (key_to_add != null) {
editor.putBoolean(key_to_add, false);
if (key_to_add != null || key_to_add != ""
Toast.makeText(arg0.getContext(),
"Aggiunta keyword: " + key_to_add,
Toast.LENGTH_SHORT).show();
final CheckBox auto_download = (CheckBox) findViewById(R.id.auto_download);
if (prefs.getBoolean("auto", false) == true) {
auto_download.setChecked(true);
CompoundButton.OnCheckedChangeListener checkedListener = new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton button, boolean checked) {
if (button == auto_download) {
editor.putBoolean("auto", auto_download.isChecked());
auto_download.setOnCheckedChangeListener(checkedListener);
editor.putBoolean(auto_download.getText().toString(), auto_download
arrayAdapter = new ArrayAdapter<String>(this, R.layout.feed_row_layout,
R.layout.feed_row_layout, createItem(prefs)) {
public View getView(int position, View convertView, ViewGroup parent) {
String item = getItem(position);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.feed_row_layout, null);
LinearLayout lr = (LinearLayout) rowView
.findViewById(R.id.feed_row_layout);
CheckBox boxPreference = new CheckBox(this.getContext());
boxPreference.setText(item);
boxPreference.setChecked(prefs.getBoolean(item, false));
boxPreference.setTextColor(R.color.black);
boxPreference.setTextSize(25);
boxPreference.setPadding(50, 0, 0, 0);
lr.addView(boxPreference);
listView.setAdapter(arrayAdapter);