Maintain/Save/Restore scroll position when returning to a ListView

Try this: // save index and top position int index = mList.getFirstVisiblePosition(); View v = mList.getChildAt(0); int top = (v == null) ? 0 : (v.getTop() – mList.getPaddingTop()); // … // restore index and position mList.setSelectionFromTop(index, top); Explanation: ListView.getFirstVisiblePosition() returns the top visible list item. But this item may be partially scrolled out of view, … Read more

How can I put a ListView into a ScrollView without it collapsing?

Here’s my solution. I’m fairly new to the Android platform, and I’m sure this is a bit hackish, especially in the part about calling .measure directly, and setting the LayoutParams.height property directly, but it works. All you have to do is call Utility.setListViewHeightBasedOnChildren(yourListView) and it will be resized to exactly accommodate the height of its … Read more

JSON parsing in fragmant [closed]

It seems that your AndroidManifest.xml doesn’t give permission for your app to access the Internet. Your error log states: Permission denied (missing INTERNET permission?) Taken from The Android docs at http://developer.android.com/reference/android/Manifest.permission.html#INTERNET String | INTERNET | Allows applications to open network sockets. Add the following line to your AndroidManifest.xml to allow Internet access: <uses-permission android:name=”android.permission.INTERNET” />