2013-02-15 5 views
0

한 클래스에서 activity 클래스로 메서드를 호출하려고했지만 edittext에서 nullpointer 예외가 발생했습니다.edittext 매개 변수를 전달하는 중

//이 나는 방법 클래스

public void getEditTextValue(EditText edittext, int resources, String DataValue , String vEditTextValue) { 

      methods md = new methods(); 
      edittext = (EditText) findViewById(resources); 
      vEditTextValue = edittext.getText().toString(); 
      md.editorSharePreferences(this, DataValue, vEditTextValue); 
     } 

에서 생성 방법이 // 제가 주요 활동 클래스의이 방법은, i는 클래스의 처음에 공개는 EditText 글고 선언 호출

public EditText edittext; 

methods md = new methods(); 

md.getEditTextValue(currentEmployerMonth, R.id.etTimeWithYourCurrentEmployerMonths, "dCurrentEmployerMonth", vCurrentEmployerMonth);  
+0

메소드 선언과 그에 대한 호출에 매개 변수의 수가 서로 다릅니다 (4와 5). 그 중 어느 쪽이 맞지 않습니까? – jprofitt

+0

내 대답을 보았 니? – Rohit

+0

yea 나는 한 클래스에서 다른 클래스로 edittext 값을 전달하지 않았다. 다른 클래스에서 edittext를 선언하는 중 – Daryl

답변

1

보내기 편집 텍스트 문자열로 값 및 기타 활동에 다시 얻을 당신이 글고의 값을 할당 할 위치를 지정

기능 (edittext.tostring());

관련 문제