처음 게시 할 때 처음 보냈습니다.다른 액티비티의 탐색 창 조각에 텍스트보기 텍스트 설정
다른 활동의 탐색 창 조각에 textView 항목의 텍스트를 설정하려고합니다.
public class SomeActivity{
...
...
NavigationDrawerFragment.textViewName.setText("words");
}
public class SomeActivity{
...
...
NavigationDrawerFragment frag = (NavigationDrawerFragment)
getFragmentManager().findFragmentByTag("NavigationDrawerFragment");
frag.GetTextFromActivityMethod("words");
}
을 내가 디버거에서 (NavigationDrawerFragment) 오류로드되지 널 포인터 예외 클래스를 얻을 :
나는 시도했습니다.
public class SomeActivity{
NavigationDrawerFragment.textViewName.setText("words");
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0);
Editor editor = pref.edit();
editor.putString("WORDS", b);
editor.commit();
}
public class SomeActivity {
NavigationDrawerFragment frag = (NavigationDrawerFragment)
getFragmentManager().findFragmentByTag("NavigationDrawerFragment");
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0);
String words = pref.getString("WORDS", null);
textView.setText
}
에 오신 것을 환영에 StackOverflow의 주요 활동에서 탐색 창 바
에서
, 나는 안드로이드 개발자 아니지만, 당신은 당신의 첫 번째 질문에 대한 칭찬 노력을했습니다 그러나 문제를 더 잘 디버깅하려면 스택 추적을 게시하는 것이 좋습니다. Null 포인터를 알려주는 것이 도움이되지만 문제를 더 잘 디버그 할 수있는 곳을 알아야합니다. – JamesENL