Created
January 18, 2016 03:34
-
-
Save mnafian/ec8fa940dddda9880712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private RelativeLayout drawInsideEditor; | |
@Bind(R.id.dp_main_layout) | |
RelativeLayout mainLayout; | |
// oncreate | |
drawInsideEditor = (RelativeLayout) View.inflate(this, R.layout.dp_text_editor_layout, null); | |
mainLayout.addView(drawInsideEditor); | |
RelativeLayout drawText = (RelativeLayout) View.inflate(this, R.layout.dp_item_textview_preview, null); | |
drawInsideEditor.addview(drawText); //ini sukses | |
updateView(drawInsideEditor); | |
//atau | |
mainLayout.addview(drawText); // ini NPE | |
updateView(mainLayout); | |
void updateview(RelativeLayout main){ | |
for (int i = 0; i < main.getChildCount(); i++) { | |
View viewLayout = main.getChildAt(i); | |
ImageButton edit = (ImageButton) viewLayout.findViewById(R.id.fab_edit); | |
edit.setBackground(....) // ini kena NPE kalo pake mainlayout. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment