package barbarahliskov.cambialibros;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

public class DeleteLibro extends AppCompatActivity {

    private ListView mList;
    List<Row> rows = new ArrayList<Row>(30);
    Row row = null;

    /**
     * Called when the activity is first created.
     *
     * @param savedInstanceState
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_list);
        setTitle("Libros favoritos");
        Button closeButton = (Button) findViewById(R.id.botonCerrar);

        closeButton.setVisibility(View.INVISIBLE);
        mList = (ListView) findViewById(R.id.list);

        mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                // ListView Clicked item index
                long itemPosition = id;




                // Show Alert
                Toast.makeText(getApplicationContext(), "Se borrara el elemento " + rows.get( (int) itemPosition).getTitulo(),
                        Toast.LENGTH_LONG).show();
                // Intent i = new Intent(LibrosFavoritos.this, Busqueda.class);
                // startActivity(i);
            }
        });




        fillData();




    }


    private void fillData() {






    }



}

@@ -1679,16 +1679,1807 @@
 ) %7B%0A%0A%0A%0A%0A
+        rows.add(new Row(%2250 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A        rows.add(new Row(%2251 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A        rows.add(new Row(%2252 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A        rows.add(new Row(%2253 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A        rows.add(new Row(%2254 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A        rows.add(new Row(%2255 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A        rows.add(new Row(%2256 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A        rows.add(new Row(%2257 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A        rows.add(new Row(%2258 sombras de Grey%22, %22Anonimo%22, %22%22, (long) 0));%0A%0A%0A%0A%0A        if (!rows.isEmpty()) %7B%0A            TextView empty = (TextView) findViewById(R.id.empty);%0A            empty.setWidth(0);%0A        %7D%0A%0A        CustomArrayAdapter c = new CustomArrayAdapter(this, rows) %7B%0A            @Override%0A            public void onClick(View v) %7B%0A                Button button = (Button) v;%0A%0A                if (button.isActivated()) %7B%0A                    button.setBackgroundResource(R.drawable.ic_slide_switch_on);%0A                    Toast.makeText(getApplicationContext(), %22Guardado como favorito%22,%0A                            Toast.LENGTH_SHORT).show();%0A                    button.setActivated(false);%0A                %7D else %7B%0A                    button.setBackgroundResource(R.drawable.ic_slide_switch_off);%0A%0A                    Toast.makeText(getApplicationContext(), %22Favorito borrado%22,%0A                            Toast.LENGTH_SHORT).show();%0A                    button.setActivated(true);%0A                %7D%0A            %7D%0A        %7D;%0A%0A        c.setIds(R.layout.activity_libros, R.id.ciudadMiLi, R.id.nombreMiLi, R.id.usuarioMiLi, R.id.distMiLi, R.id.FavMiLi);%0A%0A        mList.setAdapter(c);%0A
 %0A%0A    %7D%0A

version definitiva eliminar libro