You try to add this listener to the onCreate
event:
myCustomView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
myCustomView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
do_your_logic_to_save_bitmap_from_view;
}
});
addOnGlobalLayoutListener
will register a callback to be invoked when the global layout state or the visibility of views within the view tree changes. For example when the view is rendered completely.
3
solved Saving the current view as a bitmap