Код:
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
.