코드 :는 NullPointerException이에게 던졌습니다
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
RelativeLayout d= (RelativeLayout)findViewById(R.id.drawer_content);
final LayoutInflater inflate=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
TextView tv = (TextView)inflater.inflate(R.layout.text, null);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
tv.setLayoutParams(params);
tv.setText("Appointments");
Log.i("before", "add");
d.addView(tv);
Log.i("after", "add");
}
내 슬라이딩 서랍에 동적으로 내용을 추가 할 것을 시도하고있다,하지만 나를 NullPointerException
줄 것으로 보인다.
어떤 줄에서 예외가 발생합니까? –
줄 번호는 어떻게 얻습니까? : p – user1152312
예외가 표시됩니다. –