fragment 내에 EditText를 클릭하면 dialog박스가 뜨고
dialog박스 내에 Radio버튼으로 text를 클릭하여 edittext에 저장하고 싶습니다.
근데 기본 액티비티에서 이루어지는게 아니라
fragment 내에서 이루어지는거라서 코딩하는데 애먹고있습니다 ㅠㅠ
일단 간단하게 작성을 해봤는데 이게 아닌 것 같네요..
참고자료나 링크를 주시면 참고하겠습니다 !
public class Fragment3 extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment3, container, false);
EditText edtLoc = (EditText)v.findViewById(R.id.edt_orderloc);
EditText edtPart = (EditText)v.findViewById(R.id.edt_orderpart);
EditText edtEach = (EditText)v.findViewById(R.id.edt_ordereach);
EditText edtWeight = (EditText)v.findViewById(R.id.edt_orderweight);
EditText edtMemo = (EditText)v.findViewById(R.id.edt_ordermemo);
EditText edtTime = (EditText)v.findViewById(R.id.edt_ordertime);
Button btnOrd = (Button)v.findViewById(R.id.btn_order);
Button btnCan = (Button)v.findViewById(R.id.btn_ordercancel);
return v;
}
public void onClick(View v) {
switch(v.getId()){
case R.id.edt_orderloc :
final EditText edtLoc = (EditText)v.findViewById(R.id.edt_orderloc);
Fragment3 mContext = Fragment3.this;
AlertDialog.Builder builder;
AlertDialog dialog;
LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout=inflater.inflate(R.layout.fragment3, (ViewGroup)v.findViewById(R.id.customdialog));
builder = new AlertDialog.Builder(mContext);
builder.setView(layout);
dialog.setTitle("수령지역");
dialog.setButton("취소", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int which) {
String data = edtLoc.getText().toString();
}
}
}
}