title: Android- Remove Calendarview from DatePickerDialogFragment
body: <p>I have a Datepickerdialog fragment which works fine.When i click the button the datepickerdialog opens whixh has spinner date selection on the left side and calendar view on the right side.</p>
  
  <p>For my app in one place i want just the spinner date selection part alone to be shown(calendar view part must be removed or hidden)</p>
  
  <p>In other place i want calendar view part must be shown and the spinner date selection must be hidden or removed.</p>
  
  <p>But i tried a lot with various things like for hiding calendar view like</p>
  
  <pre><code> Method m = minDateSelector.getClass().getMethod("setCalendarViewShown", boolean.class);
   m.invoke(dp, false);
  </code></pre>
  
  <p>but when i add this i get error only...</p>
  
  <p>Same problem for this person too 
  <a href="https://stackoverflow.com/questions/14627983/datepicker-created-with-dialopfragment-showing-calender-also">Datepicker created with DialopFragment showing Calender also</a></p>
  
  <p>my code is </p>
  
  <p>DatePickerActivity.java</p>
  
  <pre><code>import java.util.Calendar;
  import android.app.Activity;
  import android.app.FragmentTransaction;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  
  public class DatePickerActivity extends Activity {
      DateDialogFragment frag;
      Button button;
      Calendar now;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          now = Calendar.getInstance();
          button = (Button)findViewById(R.id.date_button);
          button.setText(String.valueOf(now.get(Calendar.MONTH)+1)+"-"+String.valueOf(now.get(Calendar.DAY_OF_MONTH))+"-"+String.valueOf(now.get(Calendar.YEAR)));
          button.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
                  showDialog();   
              }
          });  
      }
      public void showDialog() {
          FragmentTransaction ft = getFragmentManager().beginTransaction(); //get the fragment
          frag = DateDialogFragment.newInstance(this, new DateDialogFragmentListener(){
              public void updateChangedDate(int year, int month, int day){
                  button.setText(String.valueOf(month+1)+"-"+String.valueOf(day)+"-"+String.valueOf(year));
                  now.set(year, month, day);
              }
          }, now);
  
          frag.show(ft, "DateDialogFragment");
      }
      public interface DateDialogFragmentListener{
          //this interface is a listener between the Date Dialog fragment and the activity to update the buttons date
          public void updateChangedDate(int year, int month, int day);
      }  
  }
  </code></pre>
  
  <p>DateDialogFragment.java</p>
  
  <pre><code>import java.util.Calendar;
  
  import com.zeroe.DatePickerActivity.DateDialogFragmentListener;
  
  import android.app.DatePickerDialog;
  import android.app.Dialog;
  import android.app.DialogFragment;
  import android.content.Context;
  import android.os.Bundle;
  import android.widget.DatePicker;
  
  public class DateDialogFragment extends DialogFragment {
  
      public static String TAG = "DateDialogFragment";
      static Context mContext; //I guess hold the context that called it. Needed when making a DatePickerDialog. I guess its needed when conncting the fragment with the context
      static int mYear;
      static int mMonth;
      static int mDay;
      static DateDialogFragmentListener mListener;
  
      public static DateDialogFragment newInstance(Context context, DateDialogFragmentListener listener, Calendar now) {
          DateDialogFragment dialog = new DateDialogFragment();
          mContext = context;
          mListener = listener;
  
          mYear = now.get(Calendar.YEAR);
          mMonth = now.get(Calendar.MONTH);
          mDay = now.get(Calendar.DAY_OF_MONTH);
          /*I dont really see the purpose of the below*/
          Bundle args = new Bundle();
          args.putString("title", "Choose Date");
          dialog.setArguments(args);//setArguments can only be called before fragment is attached to an activity, so right after the fragment is created
  
  
          return dialog;
      }
      public Dialog onCreateDialog(Bundle savedInstanceState) {
          return new DatePickerDialog(mContext, mDateSetListener, mYear, mMonth, mDay);
      }
      private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
  
          @Override
          public void onDateSet(DatePicker view, int year, int monthOfYear,
                  int dayOfMonth) {
              mYear = year;
              mMonth = monthOfYear;
              mDay = dayOfMonth;
  
              mListener.updateChangedDate(year, monthOfYear, dayOfMonth);
          }
      };
  }
  </code></pre>
  
  <p>main.xml</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;Button 
          android:id="@+id/date_button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="03-18-2012"
          android:onClick="clickMe"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>