Skip to content

Instantly share code, notes, and snippets.

@alfianyusufabdullah
Last active January 2, 2018 12:13
Show Gist options
  • Save alfianyusufabdullah/d4dc5267cea985c9f4aed8d024b69616 to your computer and use it in GitHub Desktop.
Save alfianyusufabdullah/d4dc5267cea985c9f4aed8d024b69616 to your computer and use it in GitHub Desktop.
medium - main 1
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) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle("EZQLite");
}
initView();
}
private void initView() {
inputNama = findViewById(R.id.inputNama);
inputNim = findViewById(R.id.inputNim);
inputSemester = findViewById(R.id.inputSemester);
etNama = findViewById(R.id.etNama);
etNim = findViewById(R.id.etNim);
etSemester = findViewById(R.id.etSemester);
btnLiatData = findViewById(R.id.btnLihatData);
btnTambahData = findViewById(R.id.btnTambahData);
btnLiatData.setOnClickListener(this);
btnTambahData.setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btnLihatData:
break;
case R.id.btnTambahData:
break;
}
}
private void hideSoftkey(View v) {
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
if (inputMethodManager != null) {
inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment