Skip to content

Instantly share code, notes, and snippets.

private Location getLastKnownLocation() {
List<String> providers = locManager.getProviders(true);
Location bestLocation = null;
for (String provider : providers) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
<TextView
android:id="@+id/img_five_min"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="5m"
android:padding="@dimen/fifteen"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/circular_corners" />
@ritunagpal
ritunagpal / Readme.md
Created June 3, 2016 08:58 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example: