Heyho, I'm pretty new to java programming for android and i hope you can help me.
Here is the method that's giving me nightmares:
    public boolean CheckInput(View v) {
    if (v.getId() != R.id.job_hunting_btn) {
    LinearLayout layout = (LinearLayout)findViewById(R.id.job_hunt_lay);
            for (int i = 0; i < layout.getChildCount(); i++) {
                View view = layout.getChildAt(i);
                Rahmen(view);
            }
        }
    }
I basically want to iterate through all the Children of my given Linear Layout and do something with them.
this is the XML file for that specific layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/job_hunt_lay"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="de.ohm.work4refugees.MainActivity">
<TextView
android:id="@+id/workas_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="@string/workas"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/workas_et"
android:layout_weight="1" />
<TextView
android:id="@+id/experience_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="@string/experience"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/experience_et"
android:layout_weight="1" />
<TextView
android:id="@+id/native_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="@string/nativel"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/native_et"
android:layout_weight="1" />
<TextView
android:id="@+id/communicate_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="@string/communicate"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/communicate_et"
android:layout_weight="1" />
<TextView
android:id="@+id/erwerbstaetigkeit_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="@string/erwerbstaetigkeit"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/erwerb">
    <RadioButton
        android:layout_width="100dp"
        android:layout_height="match_parent"
        android:text="yes"
        android:layout_weight="0.2"
        android:layout_gravity="start"
        android:scaleType="fitCenter"
        android:rotationY="10"
        android:onClick="OnButtonClick"
        android:id="@+id/yes_btn"/>
    <RadioButton
        android:layout_width="100dp"
        android:layout_height="match_parent"
        android:text="no"
        android:layout_weight="0.2"
        android:layout_gravity="center"
        android:scaleType="fitCenter"
        android:rotationY="10"
        android:onClick="OnButtonClick"
        android:id="@+id/no_btn"/>
    <RadioButton
        android:layout_width="100dp"
        android:layout_height="match_parent"
        android:text="i don't know"
        android:layout_weight="0.2"
        android:layout_gravity="end"
        android:onClick="OnButtonClick"
        android:id="@+id/dontknow_btn"/>
</RadioGroup>
<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/job_hunting_btn_1"
android:src="@drawable/btn_auswahl_rechts"
android:layout_weight="0.5"
android:padding="5dp"
android:background="@android:color/transparent"
android:scaleType="fitCenter"
android:rotationY="10"
android:layout_gravity="right"
android:onClick="OnNextButtonClick"
/>
</LinearLayout>
But all i get is a NullpointerException at for (int i = 0; i < layout.getChildCount(); i++) .
Can you help me ? (p.s: of course you noticed that there are no return values in my boolean method, thats because the method is actually a lot longer but i didn't post the whole thing, only the part that throws the exception)
EDIT: CheckInput is called here
 public void OnNextButtonClick(View v) {
    if (CheckInput(v)) {
        ViewList.get(CurrentViewId).setVisibility(View.GONE);
        if (v.getId() == R.id.job_hiring_btn)
            CurrentViewId = ArbeitgeberViewId;
        else {
            CurrentViewId++;
            if (CurrentViewId == ArbeitgeberViewId)
                CurrentViewId = LastViewId;
        }
        ViewList.get(CurrentViewId).setVisibility(View.VISIBLE);
    }
}
I want to load the next page only if the edittext input is checked and proven not empty, what would happen in Rahmen()
