Basically I have singleitemactivity where the information about a single item is displayed after fetching JSON data through URL. I am getting a `nullpointerexception` (Please view the logcat output) when I try to `setVisibility.GONE` for radiobuttons inside `onPostExecute`. 
The if else statement are added inorder to check in which category the products fall in. For example Pizza can have multiple sizes, so I have 4 prices displayed whereas sizes don't apply on sidelines so it has only one price displayed. So in order to achieve this functionality, I am trying to hide the other 3 radiobuttons if the product category is "sidelines". I hope you get it.

```
    @Override
    protected void onPostExecute(String file_url) {
        pDialog.dismiss();
        // updating UI from Background Thread 
        runOnUiThread(new Runnable() {
            @Override
    public void run() {
                /**
                 * Updating parsed JSON data into ListView
                 * */

                if(check<=2)
                {
                    Log.i("Check Value","The check value is" + check);
                    Log.i("Adapter:"," Category Value is less than 2");
                ListAdapter adapter = new SimpleAdapter(
                        SingleItemActivity.this, selquesList,
                        R.layout.single_item_layout, new String[] { TAG_newPID,
                                TAG_NAME, TAG_INFO,TAG_SMALLPRICE,TAG_MEDIUMPRICE,TAG_LARGE,TAG_xLARGE },
                        new int[] { R.id.itemid, R.id.itemname, R.id.iteminfo,R.id.smallprice, R.id.mediumprice, R.id.largeprice,R.id.xlargeprice});
                // updating listview
                setListAdapter(adapter);
                }
                else
                {
                    ListAdapter adapter2 = new SimpleAdapter(
                        SingleItemActivity.this, selquesList,
                        R.layout.single_item_layout, new String[] { TAG_newPID,
                                TAG_NAME, TAG_INFO, TAG_PRICE },
                        new int[] { R.id.itemid, R.id.itemname, R.id.iteminfo, R.id.price});

                    RadioButton mediumRadioButton = (RadioButton) findViewById(R.id.medium);
                    RadioButton largeRadioButton = (RadioButton) findViewById(R.id.large);
                    RadioButton xlargeRadioButton = (RadioButton) findViewById(R.id.xlarge);                         
                    Intent intentradiocheck = getIntent();
                    int radioavailcheck = intentradiocheck.getIntExtra("int_value", 0);
                    Log.i("SingleItemActivity","Value of radioavailcheck: "+radioavailcheck);                        
                    if(radioavailcheck > 2)
                    {
                        Log.i("SingleItemActivity","Inside the if loop because radioavailcheck>2"); 
                        mediumRadioButton.setVisibility(View.GONE);
                        largeRadioButton.setVisibility(View.GONE);
                        xlargeRadioButton.setVisibility(View.GONE);
                    }

                setListAdapter(adapter2);
                }
            }
        });
    }

```

LogCat Output:

```
 06-10 18:32:23.885: I/SingleItemActivity(306): Inside oncreate
 06-10 18:32:24.704: D/dalvikvm(306): GC_FOR_MALLOC freed 3410 objects / 387688 bytes in 341ms
 06-10 18:32:25.624: D/All Items:(306): {"success":1,"menu":[{"price":"3.95","itemID":"8","categoryID":"3","itemname":"Beer Nastro","iteminfo":"Beer","small":"0","large":"0","medium":"0","xlarge":"0","discount":"0"}]}
 06-10 18:32:25.634: I/SingleItemActivity(306): Value of radioavailcheck: 3
 06-10 18:32:25.634: I/SingleItemActivity(306): Inside the if loop because radioavailcheck>2
 06-10 18:32:25.634: D/AndroidRuntime(306): Shutting down VM
 06-10 18:32:25.634: W/dalvikvm(306): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
 06-10 18:32:25.644: E/AndroidRuntime(306): FATAL EXCEPTION: main
 06-10 18:32:25.644: E/AndroidRuntime(306): java.lang.NullPointerException
 06-10 18:32:25.644: E/AndroidRuntime(306):     at com.wbs.ginos.SingleItemActivity$LoadAllSelques$1.run(SingleItemActivity.java:243)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at android.app.Activity.runOnUiThread(Activity.java:3707)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at com.wbs.ginos.SingleItemActivity$LoadAllSelques.onPostExecute(SingleItemActivity.java:207)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at com.wbs.ginos.SingleItemActivity$LoadAllSelques.onPostExecute(SingleItemActivity.java:1)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at android.os.AsyncTask.finish(AsyncTask.java:417)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at android.os.AsyncTask.access$300(AsyncTask.java:127)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at android.os.Handler.dispatchMessage(Handler.java:99)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at android.os.Looper.loop(Looper.java:123)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at android.app.ActivityThread.main(ActivityThread.java:4627)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at java.lang.reflect.Method.invokeNative(Native Method)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at java.lang.reflect.Method.invoke(Method.java:521)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 06-10 18:32:25.644: E/AndroidRuntime(306):     at dalvik.system.NativeStart.main(Native Method)

```

`

Radiogroup code in single\_item\_layout.xml

```
      <RadioGroup
        android:id="@+id/group1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="90"
        android:orientation="vertical" >

        <RadioButton
            android:id="@+id/small"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true" />

        <RadioButton
            android:id="@+id/medium"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <RadioButton
            android:id="@+id/large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <RadioButton
            android:id="@+id/xlarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </RadioGroup>

```