I need to access inner textview via layout inflater
sudo hirarchy:
<relative layout id="rlRoot">
<relative layout>
<linear layout>
<linear layout>
<relative layout id="rlTv">
<textView id="tvOne">
I want to dynamically set value for the id tvOne through toast.
Logic I used as below
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.test, (ViewGroup) findViewById(R.id.rlRoot));
TextView txtId = (TextView) layout.findViewById(R.id.tvOne);
txtId.setText("Id: " + getId());
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.FILL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();
But this gives "View not attached to window manager". I also changed rlRoot to rlTv. But same error. How can I access this nested text view?