php compact function

The compact() function is the reverse of extract(). Pass it the variable names to compact either as separate parameters or in an array. The compact() function creates an associative array whose keys are the variable names and whose values are the variable’s values. Any names in the array that do not correspond to actual variables … Read more

php extract

The extract() function automatically creates local variables from an array. The indices of the array elements become the variable names: $person = array(‘name’ => “Fred”, ‘age’ => 35, ‘wife’ => “Betty”); extract($person); // $name, $age, and $wife are now set extract Example in php

PermissionsDispatcher Library to make Easier Permission Requests

Full project with source code to request certain “dangerous” permissions at runtime. This process usually needs a lot of if/else checks, but the PermissionsDispatcher library simplifies this with the use of annotations. We will learn how to request a permission, how to show a proper rationale and how to handle situations when the user granted … Read more

Android TimeSquare | CalendarPickerView

Full project with source code by using the TimeSquare library to create a CalendarPickerView, which is a nice alternative to the standart DatePickerDialog. We can set a minDate and a maxDate for the range and get our selected date back by setting an OnDateSelectedListener on it. We will format this date by using the DateFormat … Read more

Android to Send Data Back from Child Activity with startActivityForResult

Full project with source code When we open another activity, we can send data to it by using an intent and putExtra. But what if we also want to get something back? This is what the startActivityForResult method is for. By opening our child activity with this method and overriding onActivityResult we can send data … Read more