I am in activity MainActivity which use the layout main2:
setContentView(R.layout.main2);
Now I want to get view "btnDisplay " from another layout called " row_in_list_test" .
I did :
LinearLayout row_in_list_tests = (LinearLayout) findViewById(R.id.row_in_list_tests);
btnDisplay = (Button) row_in_list_tests.findViewById(R.id.btnDisplay); //null pointer exception
btnDisplay.setOnClickListener(new OnClickListener() { ..
but in runTime i get "null pointer exception".
When I get btnDisplay in this way :
btnDisplay = (Button) findViewById(R.id.btnDisplay);
it is work good but then I get "null pointer exception" in the next line :
btnDisplay.setOnClickListener(new OnClickListener() { .. /null pointer exception
What is the way to do it? (I don't need to inflate " row_in_list_test" , it is just a layout for ArrayAdapter0