Skip to content

Instantly share code, notes, and snippets.

@nseidm1
nseidm1 / gist:9252142
Last active August 29, 2015 13:56
The ChildConsiderateFragment allows fragments to be defined in it's xml layout. The child fragments will be determined in the onCreateView callback by parsing the xml layout returned by the abstract getLayoutId method. The child fragments will automatically be cleaned up in the onDestroyView callback.
package com.paltalk.chat.utils;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import android.content.res.XmlResourceParser;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@nseidm1
nseidm1 / gist:8544457
Last active January 4, 2016 00:49
Workaround for Chips to add a telephone number programmatically with a successful chip conversion. This is the code that's run from an onActivityResult after a telephone number selection.
private void processPickResult(final Intent data) {
final Handler handler = new Handler();
ExecutorManager.sInstance.mExecutor.execute(new Runnable() {
@Override
public void run() {
Uri pickedPhoneNumber = data.getData();
Cursor cursor = getContentResolver().query(pickedPhoneNumber, null, null, null, null);
try{
if (cursor.moveToFirst()) {
final String telephone = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DATA1));
@nseidm1
nseidm1 / gist:8345290
Last active January 2, 2016 18:39
A tremendously simplified, and increasingly reliable implementation of the AOSP messaging app's MMS TransactionService.
/*
* Copyright (C) 2007-2008 Esmertec AG.
* Copyright (C) 2007-2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*