2011-03-02 4 views
-1

가능한 중복 :
How to print the data which is coming from the edittext?EditText 콘텐츠를 로그에 인쇄하는 방법은 무엇입니까?

당신이 거기 로그 캣에 결과를 출력하지만이 보이지 될 것입니다 무엇을 쓸
final ViewGroup layout6 = (ViewGroup) LayoutInflater.from(Menus.this) 
    .inflate(R.layout.beefkabobsandwhichdialog, null); 

AlertDialog.Builder builder6 = new AlertDialog.Builder(Menus.this); 
builder6.setView(
    LayoutInflater.from(Menus.this) 
     .inflate(R.layout.beefkabobsandwhichdialog, null)); 
builder6.setPositiveButton("Add2Order",new DialogInterface.OnClickListener() { 
    public void onClick(DialogInterface dialog, int which) { 
     String str = ((EditText)layout6.findViewById(R.id.quantityedittext1)) 
      .getText().toString(); 
     System.out.println(str); 
    } 
}); 
+0

다시 안녕하세요. 너는 방금이 질문을했다, 그렇지? downvote 좋은 하루 되세요. – Klaus

+1

하지만 logcat에 str 값을 인쇄 할 수 없습니다 ... y ?? – sam

+1

복제본 : http://stackoverflow.com/questions/5167703/how-to-print-the-data-which-is-coming-from-the-edittext – HaskellElephant

답변

1

. 두 가지 당신이 시도 할 수 있습니다

그것을 놓치고 힘들 것

System.out.println("****************************************************"); 
System.out.println(str);  
System.out.println("****************************************************"); 

System.out.println(str); 

를 교체합니다.

사람들이 일반적으로하는 일은 Logcat 형식으로 인쇄됩니다.

Log.i(tag, str); 

'태그'여기에 문자열이며 로그 캣의 왼쪽 칼럼에 표시됩니다 : 여기에 그것을 수행하는 방법에 대한 코드입니다. 이렇게하면 선택한 태그로 로그를 표시하는 필터를 추가 할 수 있으므로 식별하기가 매우 쉽습니다. 이것은 권장되는 방법이지만 표준 System.out.println()을 사용할 수 있습니다. 그것은 효과가 있으며,보기가 정말 어렵습니다.

+0

log.i (tag, str);를 사용하십시오. 모든 안드로이드 프로젝트를위한 형식. 이것은 표준이며 장기적으로 당신의 삶을 편하게 만듭니다. – FuegoFingers

+0

나는 이것이 나 또는 rajesh에게 지시 되었는가, 이해하지 못한다? – NotACleverMan

관련 문제