Skip to main content

Posts

Showing posts from December, 2014

Registering your app in facebook to use SDK in development - Hash key Issue

This should be trivial but sometimes things don't work and for me this was one of the days where multiple things go wrong some from me and others from facebook and android to make a solid challenge. In summary I wanted to implement facebook share in android app, I had the sdk but it wasn't plugged in my app, and to do that you need to follow the facebook get started guide by creating an app and adding the id in the manifest   <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/> now at one step facebook tells you to generate a Hash key as signature for your app.. they tell you to use openSSL utility, that just didn't work with me and generated wrong hash so after research I was able to fix my issues and integration with facebook worked. That day I wrote the below answer to this stack overflow question on this specific issue : http://stackoverflow.com/questions/20301025/facebook-key-hash-does-not-match-any-stored-ke…

Android RecyclerView - Adding Empty View

So RecyclerView was introduced to replace List view and it's optimized to reuse existing views and so it's faster and more efficient as stated in the documentation:

https://developer.android.com/training/material/lists-cards.html

While using it, I faced the issue of missing a useful functionality that is implemented in ListView.
that feature is setting an empty view in case there was no records.

In ListView it was as simple as this

View emptyView = findViewById(R.id.mylist_empty_view);
ListView  myList = ....
myList.setEmptyView(emptyView);

but this method doesn't exist for recycler view so we need a work around until android team fixes this.


and here are the screen shots of both list view and recycler view fix

List view :

Recycler view :



here is how I fixed it:



here is the content of empty_view, it can be anything.



Enjoy.