DialogFragments(DatePicker) and GDActivity (GreenDroid): multiple inheritance
===

I have a problem on my app that is the next:

I want to display new DatePicker published on android 3.0 and above.
To be done, you have to use *** DialogFragment *** class (to get use of *** getSupportFragmentManager() *** function ) and your class must be extend it;.

[link] http://developer.android.com/guide/topics/ui/controls/pickers.html

On the other side, I use GreenDroid library on my proyecto and I use on it functions like *** getActionBar(), onHandleActionBarItemClick(ActionBarItem item, int pos)***, so on. And, of course, to do use of this functions, you have to extends to *** GDActivity *** (in my case).

This question is answered by the author, Cyril Mottier, but I tried and I failed.
[link] https://github.com/cyrilmottier/GreenDroid/issues/57

And this is what I do:

GreenDroid has an interface of ActionBar, and I thinks that a have to implements this behaviour into my class, so I implements the unimplements methods (basically copy and paste).

    public class Pedidos_main extends FragmentActivity implements ActionBarActivity
{

	private int año_actual;
	private int mes_actual;
	private int dia_actual;

	private int mActionBarType;

	private ActionBarHost mActionBarHost;

	private int Dashboard = 0;
	private int Empty = 1;
	private int Normal = 2;


	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		
		setContentView(R.layout.pedidos_main_allviews);

		onPreContentChanged(); // this method don't start automatically
		
		ActionBar barra_top = getActionBar();
		
		establecer_tipo_ActionBar(Normal);
		
		barra_top.setTitle("Pedidos");
		barra_top.addItem(Type.Add,0);
		barra_top.addItem(Type.Star,1);
		
	 

		
		/* fecha actual */
		final Calendar c = Calendar.getInstance();
        año_actual = c.get(Calendar.YEAR);
        mes_actual = c.get(Calendar.MONTH);
        dia_actual = c.get(Calendar.DAY_OF_MONTH);
		
		
		filtrado_opciones.setOnCheckedChangeListener(this);
		
		

	}
	

     // get Action bar
    public ActionBar getActionBar() 
    {
    	 mActionBarHost = (ActionBarHost) findViewById(R.id.gd_action_bar_host);
         if (mActionBarHost == null) {
             throw new RuntimeException("Your content must have an ActionBarHost whose id attribute is R.id.gd_action_bar_host");
         }
         mActionBarHost.getActionBar().setOnActionBarListener(mActionBarListener);
       
        return mActionBarHost.getActionBar();
    }

    // set de listener
    public void setOnActionBarListener(OnActionBarListener listener) {
        mOnActionBarListener = listener;
    }
    
    
    
	public void onCheckedChanged(RadioGroup group, int checkedId) 
	{
		int opcion_seleccionada = group.getCheckedRadioButtonId();
		
		switch (opcion_seleccionada)
		{

			case R.id.pedidos_main_filtro_cliente_radiobutton: 
			{
				filtro_por_cliente.setEnabled(true);
				filtro_por_cliente.setClickable(true);
				filtro_por_cliente.setFocusable(true);
				filtro_por_cliente.setFocusableInTouchMode(true);
				filtro_por_cliente.requestFocus();
				
				break;
			}
			
			default: 
			{
				filtro_por_cliente.setEnabled(false);
				filtro_por_cliente.setClickable(false);
				filtro_por_cliente.setFocusable(false);
				filtro_por_cliente.setFocusableInTouchMode(false);
				filtro_por_cliente.clearFocus();
			
				break;
				
				
			}
	
		}
		
	}
	

    // this class listening to clicks on Action Bar
    public boolean onHandleActionBarItemClick(ActionBarItem item, int pos)
    {
        // do stuff depending when you click.
    }

    void opendialog()
    {
		DialogFragment nueva_fecha = new Dialogo_Fecha();
		nueva_fecha.show(getSupportFragmentManager(), "datePicker");
    }
    
   


	
	protected void ensureLayout() {
        if (!verifyLayout()) {
            setContentView(createLayout());
        }
    }
	
	protected boolean verifyLayout() {
        return mActionBarHost != null;
    }
	
	
	public FrameLayout getContentView() {
        ensureLayout();
        return mActionBarHost.getContentView();
    }


	public ActionBar getActionBar() {
        ensureLayout();
        return mActionBarHost.getActionBar();
    }

	


	public GDApplication getGDApplication() {
        return (GDApplication) getApplication();
    }


	 public ActionBarItem addActionBarItem(ActionBarItem item) {
	        return getActionBar().addItem(item);
	    }

	    public ActionBarItem addActionBarItem(ActionBarItem item, int itemId) {
	        return getActionBar().addItem(item, itemId);
	    }

	    public ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType) {
	        return getActionBar().addItem(actionBarItemType);
	    }

	    public ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType, int itemId) {
	        return getActionBar().addItem(actionBarItemType, itemId);
	    }


	    
	 public void establecer_tipo_ActionBar(int tipo)
	 {
		 mActionBarType = tipo;
	 }
	 
	 public int createLayout() 
	    {
	        switch (mActionBarType) {
	            case 0:
	                return R.layout.gd_content_dashboard;
	            case 1:
	                return R.layout.gd_content_empty;
	            case 2:
	            default:
	                return R.layout.gd_content_normal;
	        }
	    }


    **This is a method that start at the begining of the activity** 
	 public void onPreContentChanged() 
	 
	 {
		    mActionBarHost = new ActionBarHost(this);
	        mActionBarHost = (ActionBarHost) findViewById(R.id.gd_action_bar_host);
	        
	        if (mActionBarHost == null) {
	            throw new RuntimeException("Your content must have an ActionBarHost whose id attribute is R.id.gd_action_bar_host");
	        }
	        mActionBarHost.getActionBar().setOnActionBarListener(mActionBarListener);
	    }

    **This is a method that start at the end of the activity**

	    public void onPostContentChanged() {
	    	
	    	
	        boolean titleSet = false;

	        final Intent intent = getIntent();
	        if (intent != null) {
	            String title = intent.getStringExtra(ActionBarActivity.GD_ACTION_BAR_TITLE);
	            if (title != null) {
	                titleSet = true;
	                setTitle(title);
	            }
	        }

	        if (!titleSet) {
	            // No title has been set via the Intent. Let's look in the
	            // ActivityInfo
	            try {
	                final ActivityInfo activityInfo = getPackageManager().getActivityInfo(getComponentName(), 0);
	                if (activityInfo.labelRes != 0) {
	                    setTitle(activityInfo.labelRes);
	                }
	            } catch (NameNotFoundException e) {
	                // Do nothing
	            }
	        }

	        final int visibility = intent.getIntExtra(ActionBarActivity.GD_ACTION_BAR_VISIBILITY, View.VISIBLE);
	        getActionBar().setVisibility(visibility);
	    }

    **this is the listener of the ActionBar for the items when you click.**
	    private OnActionBarListener mActionBarListener = new OnActionBarListener() {
	        public void onActionBarItemClicked(int position) {
	            if (position == OnActionBarListener.HOME_ITEM) {

	                final GDApplication app = getGDApplication();
	                switch (mActionBarType) {
	                    case 2:
	                        final Class<?> klass = app.getHomeActivityClass();
	                        if (klass != null && !klass.equals(Pedidos_main.this.getClass())) {
	                        
	                            Intent homeIntent = new Intent(Pedidos_main.this, klass);
	                            homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
	                            startActivity(homeIntent);
	                        }
	                        break;
	                    case 0:
	                        final Intent appIntent = app.getMainApplicationIntent();
	                        if (appIntent != null) {
	                      
	                            startActivity(appIntent);
	                        }
	                        break;
	                }

	            } else {
	                if (!onHandleActionBarItemClick(getActionBar().getItem(position), position)) {
	                    if (Config.GD_WARNING_LOGS_ENABLED) {
	                        //Log.w(LOG_TAG, "Click on item at position " + position + " dropped down to the floor");
	                    }
	                }
	            }
	        }
	    };

}

And the Dialogo_Fecha is the class for the dialog that display the date (extends DialogFragment):


After fix the error on compilation, I have the next error:

     mActionBarHost = (ActionBarHost) findViewById(R.id.gd_action_bar_host): THIS RETURN NULL.

Someone have an idea what its going on?. I do getActionBar() in other activities and no problem. I don't know where it can be what I do wrong.

I don't have problem with fragment dialog implementation. The problem is inherit of two clases. I don't know what I do this. 

If someone have experience in this field, please tell me what the "correct way" to do this or simply, how I can do this. 

Thank you in advise.





