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
public class ListActivity extends AppCompatActivity implements OnItemClickListener { | |
RecyclerView listMahasiswa; | |
List<ModelMahasiswa> dataMahasiswa = new ArrayList<>(); | |
AdapterDaftarMahasiswa adapterDaftarMahasiswa; | |
EZQLite ezqLite; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="com.alfianyusufabdullah.crudezqlite.ListActivity"> | |
<android.support.v7.widget.RecyclerView | |
android:id="@+id/listMahasiswa" | |
android:layout_width="match_parent" |
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
@Override | |
public void onClick(View view) { | |
switch (view.getId()) { | |
case R.id.btnLihatData: | |
startActivity(new Intent(MainActivity.this , ListActivity.class)); | |
break; | |
case R.id.btnTambahData: | |
... | |
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
/** | |
* Created by jonesrandom on 1/2/18. | |
* | |
* @site www.androidexample.web.id | |
* @github @alfianyusufabdullah | |
*/ | |
public class AdapterDaftarMahasiswa extends RecyclerView.Adapter<HolderDaftarMahasiswa> { | |
private List<ModelMahasiswa> data; |
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
/** | |
* Created by jonesrandom on 1/2/18. | |
* | |
* @site www.androidexample.web.id | |
* @github @alfianyusufabdullah | |
*/ | |
public class HolderDaftarMahasiswa extends RecyclerView.ViewHolder { | |
private TextView rowNamaMahasiswa, rowNimMahasiswa, rowSemesterMahasiswa; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_margin="10dp" | |
android:orientation="horizontal"> | |
<ImageView | |
android:layout_width="50dp" | |
android:layout_height="50dp" |
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
/** | |
* Created by jonesrandom on 1/2/18. | |
* | |
* @site www.androidexample.web.id | |
* @github @alfianyusufabdullah | |
*/ | |
public interface OnItemClickListener { | |
void Click(View v, ModelMahasiswa mahasiswa, int pos); | |
} |
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
/** | |
* Created by jonesrandom on 1/2/18. | |
* | |
* @site www.androidexample.web.id | |
* @github @alfianyusufabdullah | |
*/ | |
public class ModelMahasiswa implements Parcelable { | |
private int id; |
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
@Override | |
public void onClick(View view) { | |
switch (view.getId()) { | |
case R.id.btnLihatData: | |
break; | |
case R.id.btnTambahData: | |
textNama = etNama.getText().toString().trim(); | |
textNim = etNim.getText().toString(); |
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
public class MainActivity extends AppCompatActivity implements View.OnClickListener { | |
TextInputLayout inputNama, inputNim, inputSemester; | |
TextInputEditText etNama, etNim, etSemester; | |
Button btnTambahData, btnLiatData; | |
String textNama, textNim, textSemester; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |