android – RecyclerView notifyDataSetChanged scrolls to top position-ThrowExceptions

Exception or error: when calling notifyDataSetChanged on RecyclerView it doesn’t retain the scroll position and scrolls to top, is there any solution to retain it’s scroll position? How to solve: If your RecyclerView list item parent has “wrap_content” property, Recyclerview calculates the heights again and scrolls top. There are two solutions: Set your height a …

android – How can I focus on a collapsible action view EditText item in the action bar (when it is expanded) and force the soft keyboard to open?-ThrowExceptions

Exception or error: I am using Jake Wharton’s excellent ActionBarSherlock library and have a collapsible search action view. I want to popup the soft keyboard when the search action view is expanded. We can read a recommended way of doing this in a DialogFragment in the “Using DialogFragments” blog post by Google (altered a bit …

Top and bottom dividers not showing in Android listview-ThrowExceptions

Exception or error: The way I understand it, the divider defined for a listview should appear at the top and bottom of the list too, i.e. above the first item and under the last item. For some reason they don’t appear in my listview: <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/mainLayout” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:background=”@drawable/background”> <ImageView android:id=”@+id/home” …

android – How to snap RecyclerView items so that every X items would be considered like a single unit to snap to?-ThrowExceptions

Exception or error: Background It’s possible to snap a RecyclerView to its center using : LinearSnapHelper().attachToRecyclerView(recyclerView) Example: MainActivity.kt class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val inflater = LayoutInflater.from(this) recyclerView.adapter = object : RecyclerView.Adapter<RecyclerView.ViewHolder>() { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { val textView = holder.itemView as TextView textView.setBackgroundColor(if (position …

Android webview capture link clicks-ThrowExceptions

Exception or error: The application i’m developing has a webview, i need to capture webview request click events(eg: click on a link, click on a button, click on a youtube video play button such as…) How to solve: This can be done you have to set a WebViewClient to your WebView. this is how to …

Navbar overlapping last ListView item (Android)-ThrowExceptions

Exception or error: My problem is similar to above Image I am getting this issue in Nexus Devices. I added margin from bottom by getting Bottom Navigation Bar height. But my application is showing extra margin from the bottom on a tablet. I do not want to change anything in my style file. Code:- <android.support.design.widget.CoordinatorLayout …