How To Find And Cast View Using Generic In Android
private Button btnMakeObjectRequest, btnMakeArrayRequest;private TextView txtResponse;
btnMakeArrayRequest = findViewByIdAndCast(R.id.btnArrayRequest); btnMakeObjectRequest = findViewByIdAndCast(R.id.btnObjRequest); txtResponse = findViewByIdAndCast(R.id.txtResponse);
@SuppressWarnings("uncheked") private <T> T findViewByIdAndCast(int id) { return (T) findViewById(id); }
No comments :
Post a Comment