Skip to content

Instantly share code, notes, and snippets.

Love Lindström ntlv

  • Stockholm, Sweden
View GitHub Profile
ntlv /
Created Aug 30, 2016
Transform a Android view tree into a json tree.
//Breadth first view tree -> json transformation
private static final String CHILDREN = "children";
private Object extract(ViewGroup container) throws JSONException {
final Map<String, Object> result = new HashMap<>(); //create root node
List<Object> currentNodeList = new LinkedList<>();

Keybase proof

I hereby claim:

  • I am ntlv on github.
  • I am ntlv ( on keybase.
  • I have a public key whose fingerprint is 3FFB 6691 6CAB FA1B E10D 3853 7909 D311 2298 F4A3

To claim this, I am signing this object:

ntlv /
Last active Jan 1, 2016
show a fragment
private void showFragmentRoutine(Class<?> fragment, String tag) {
try {
FragmentManager fm = getFragmentManager();
if (fm.findFragmentByTag(tag) != null) {
fm.popBackStack(tag, 0);
} else {
.replace(, (Fragment) Class.forName(fragment.getName()).newInstance(), tag)
You can’t perform that action at this time.