したがって、カーソルアダプターを備えた素敵な小さなリストがあります。
作成後、保持する値の種類に応じて行に色を付けようとしています。以下のこの関数でそれを行います。問題:
「list.setOnItemClickListener()...」からこの関数を呼び出すと、完全に実行されます。
しかし、OnCreate()から呼び出すと、"TextView tv = (TextView) childview.findViewById(R.id.row_eszkoz_lertarozott_allapot);" で nullpointerexeption が発生します。行。
これは何が原因ですか?
public void ConditionalColoring()
{
    for (int position=0; position<adapter.getCount(); position++)
    {
        System.out.println("adapter child szám: " + adapter.getCount());
        View childview = list.getChildAt(position);
        //View childview = adapter.getView(position, null , list);
        TextView tv = (TextView) childview.findViewById(R.id.row_eszkoz_leltarozott_allapot);   ///ERROR HERE
        RelativeLayout RL = (RelativeLayout) childview.findViewById(R.id.row_eszkoz_container);
        String s = (String) tv.getText();
        System.out.println("szöveg: " + s);
        if (s.equals("leltárazva")) {
            int holoblue = activity.getResources().getColor(android.R.color.holo_blue_light);
            RL.getBackground().setColorFilter(holoblue,PorterDuff.Mode.MULTIPLY);
        }
        else if (s.equals("leltározandó")) {
            int hologreen = activity.getResources().getColor(android.R.color.holo_blue_light);
            RL.getBackground().setColorFilter(hologreen,PorterDuff.Mode.MULTIPLY);
        }
        else if (s.equals("módosítási tranzakció szükséges")) {
            int holored = activity.getResources().getColor(android.R.color.holo_blue_light);
            RL.getBackground().setColorFilter(holored,PorterDuff.Mode.MULTIPLY);
        } 
        else {
        }
    }
}