Created
May 1, 2020 03:58
-
-
Save tatd3v/08520bdd500c65e5fb23ebbff8858cb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.edu.uac.co.grupo6_act4; | |
| import androidx.annotation.NonNull; | |
| import androidx.appcompat.app.AppCompatActivity; | |
| import android.database.Cursor; | |
| import android.os.Bundle; | |
| import android.view.Menu; | |
| import android.view.MenuInflater; | |
| import android.view.MenuItem; | |
| import android.view.View; | |
| import android.widget.AdapterView; | |
| import android.widget.CheckBox; | |
| import android.widget.ListView; | |
| import android.widget.Toast; | |
| public class ListActivity extends AppCompatActivity { | |
| PatientController pC; | |
| ListView pList; | |
| Patient pat; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_list); | |
| pList = findViewById(R.id.infoListLV); | |
| pC = new PatientController(getApplicationContext()); | |
| Cursor c = pC.allPatients(); | |
| PatientCursorAdapter pca = new PatientCursorAdapter(this, c, 0); | |
| pList.setAdapter(pca); | |
| pca.notifyDataSetChanged(); | |
| } | |
| @Override | |
| public boolean onCreateOptionsMenu(Menu menu) { | |
| getMenuInflater().inflate(R.menu.list_activity_toolbar, menu); | |
| return super.onCreateOptionsMenu(menu); | |
| } | |
| @Override | |
| public boolean onOptionsItemSelected(@NonNull MenuItem item) { | |
| switch (item.getItemId()){ | |
| case R.id.edit: | |
| Toast.makeText(this, "Editar", Toast.LENGTH_SHORT).show(); | |
| return true; | |
| case R.id.delete: | |
| Toast.makeText(this, "Delete", Toast.LENGTH_SHORT).show(); | |
| return true; | |
| } | |
| return super.onOptionsItemSelected(item); | |
| } | |
| /*public void UpdateData() { | |
| pList.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |
| @Override | |
| public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | |
| } | |
| }); | |
| }*/ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment