Back to project page RoboBinding-gallery.
The source code is released under:
Apache License
If you think the Android project RoboBinding-gallery listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.robobinding.gallery.activity; /*from w ww . j a va 2 s.co m*/ import org.robobinding.ViewBinder; import org.robobinding.binder.BinderFactory; import org.robobinding.binder.BinderFactoryBuilder; import org.robobinding.gallery.R; import org.robobinding.gallery.model.customcomponent.TitleDescriptionBar; import org.robobinding.gallery.model.customcomponent.TitleDescriptionBarBinding; import org.robobinding.gallery.presentationmodel.CustomComponentPresentationModel; import android.app.Activity; import android.os.Bundle; import android.view.View; /** * * @since 1.0 * @version $Revision: 1.0 $ * @author Cheng Wei */ public class CustomComponentActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CustomComponentPresentationModel presentationModel = new CustomComponentPresentationModel(); initializeContentView(R.layout.activity_custom_component, presentationModel); } private void initializeContentView(int layoutId, Object presentationModel) { ViewBinder viewBinder = createViewBinder(); View rootView = viewBinder.inflateAndBind(layoutId, presentationModel); setContentView(rootView); } private ViewBinder createViewBinder() { BinderFactory binderFactory = new BinderFactoryBuilder() .mapView(TitleDescriptionBar.class, new TitleDescriptionBarBinding()) .build(); return binderFactory.createViewBinder(this); } }