Null pointer while displaying rating dynamically with ratingbar
Getting null pointer exception while displaying rating with ratingbar. 

in xml
 

    <RatingBar
           android:id="@+id/ratingbar3"
           style="?android:attr/ratingBarStyleSmall"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:isIndicator="true"
           android:max="5" />

in java file

    RatingBar myRatingBar = (RatingBar) findViewById(R.id.ratingbar3);
                    final float MaxRating = 3.5f;
                    myRatingBar.setRating(MaxRating);
Here I'm trying to display static rating with ratingbar it is throwing below error in my errorlog. Here i'm not allowing user to rate, i'm just displaying rating. please check this. Thanks in advance.

    01-04 14:06:05.686: E/AndroidRuntime(400): FATAL EXCEPTION: main
    01-04 14:06:05.686: E/AndroidRuntime(400): java.lang.NullPointerException
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at com.UserLogin.EventDisplay$StudentListAdapter.getView(EventDisplay.java:145)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.AbsListView.obtainView(AbsListView.java:1315)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.ListView.makeAndAddView(ListView.java:1727)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.ListView.fillDown(ListView.java:652)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.ListView.fillFromTop(ListView.java:709)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.ListView.layoutChildren(ListView.java:1580)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.AbsListView.onLayout(AbsListView.java:1147)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.View.layout(View.java:7035)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.View.layout(View.java:7035)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.View.layout(View.java:7035)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.View.layout(View.java:7035)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.os.Handler.dispatchMessage(Handler.java:99)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.os.Looper.loop(Looper.java:123)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at java.lang.reflect.Method.invokeNative(Native Method)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at java.lang.reflect.Method.invoke(Method.java:521)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at dalvik.system.NativeStart.main(Native Method)


Null pointer while displaying rating dynamically with ratingbar
===

Getting null pointer exception while displaying rating with ratingbar. 

in xml
 

    <RatingBar
           android:id="@+id/ratingbar3"
           style="?android:attr/ratingBarStyleSmall"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:isIndicator="true"
           android:max="5" />

in java file

    RatingBar myRatingBar = (RatingBar) findViewById(R.id.ratingbar3);
                    final float MaxRating = 3.5f;
                    myRatingBar.setRating(MaxRating);
Here I'm trying to display static rating with ratingbar it is throwing below error in my errorlog. Here i'm not allowing user to rate, i'm just displaying rating. please check this. Thanks in advance.

    01-04 14:06:05.686: E/AndroidRuntime(400): FATAL EXCEPTION: main
    01-04 14:06:05.686: E/AndroidRuntime(400): java.lang.NullPointerException
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at com.UserLogin.EventDisplay$StudentListAdapter.getView(EventDisplay.java:145)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.AbsListView.obtainView(AbsListView.java:1315)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.ListView.makeAndAddView(ListView.java:1727)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.ListView.fillDown(ListView.java:652)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.ListView.fillFromTop(ListView.java:709)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.ListView.layoutChildren(ListView.java:1580)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.AbsListView.onLayout(AbsListView.java:1147)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.View.layout(View.java:7035)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.View.layout(View.java:7035)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.View.layout(View.java:7035)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.View.layout(View.java:7035)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.os.Handler.dispatchMessage(Handler.java:99)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.os.Looper.loop(Looper.java:123)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at java.lang.reflect.Method.invokeNative(Native Method)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at java.lang.reflect.Method.invoke(Method.java:521)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    01-04 14:06:05.686: E/AndroidRuntime(400): 	at dalvik.system.NativeStart.main(Native Method)

