commonsware-cwac

WakefulIntentService implementation clarifications

人走茶凉 提交于 2019-11-29 11:11:01
Commonsware's WakefulIntentService works beautifully but there are some things I do not quite get. Below is the core of the service - a stripped down version of the source : class WIS extends IntentService { private static final String NAME = WIS.class.getName() + ".Lock"; private static volatile WakeLock lockStatic = null; synchronized private static PowerManager.WakeLock getLock(Context context) { if (lockStatic == null) { PowerManager mgr = (PowerManager) context .getSystemService(Context.POWER_SERVICE); lockStatic = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, NAME); lockStatic

Endless Gridview

爱⌒轻易说出口 提交于 2019-11-29 02:33:13
I have looked at lots of implementations of endless lists. One of them is https://github.com/commonsguy/cwac-endless All of them are using listviews. And all of them are simply adding another row to the list. But when we consider Gridview (like in Google Play Store) and add the loading view as another item in the grid, it looks ugly. How can I achive the same thing in the Play Store? i have write a scroll listener and set this scroll listener to my grid view . please correct me if found error. EG: final GridView g = (GridView) findViewById(R.id.myGrid); g.setAdapter(new ImageAdapter(this));

WakefulIntentService implementation clarifications

前提是你 提交于 2019-11-28 04:32:47
问题 Commonsware's WakefulIntentService works beautifully but there are some things I do not quite get. Below is the core of the service - a stripped down version of the source : class WIS extends IntentService { private static final String NAME = WIS.class.getName() + ".Lock"; private static volatile WakeLock lockStatic = null; synchronized private static PowerManager.WakeLock getLock(Context context) { if (lockStatic == null) { PowerManager mgr = (PowerManager) context .getSystemService(Context

Endless Gridview

雨燕双飞 提交于 2019-11-27 17:03:45
问题 I have looked at lots of implementations of endless lists. One of them is https://github.com/commonsguy/cwac-endless All of them are using listviews. And all of them are simply adding another row to the list. But when we consider Gridview (like in Google Play Store) and add the loading view as another item in the grid, it looks ugly. How can I achive the same thing in the Play Store? 回答1: i have write a scroll listener and set this scroll listener to my grid view . please correct me if found

ListView random IndexOutOfBoundsException on Froyo

回眸只為那壹抹淺笑 提交于 2019-11-27 12:46:31
I have an app with tons of downloads and I'm receiving a lot of this error: 16783 AndroidRuntime E java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 16783 AndroidRuntime E at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257) 16783 AndroidRuntime E at java.util.ArrayList.get(ArrayList.java:311) 16783 AndroidRuntime E at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:16 4) 16783 AndroidRuntime E at android.widget.ListView.dispatchDrawWithExcessScroll_Default(ListView.java:3 288) 16783 AndroidRuntime E at android.widget.ListView

Sending message to a Handler on a dead thread when getting a location from an IntentService

你离开我真会死。 提交于 2019-11-27 06:44:42
My app needs location fixes on regular basis, even when the phone is not awake. To do this, I am using IntentService with the pattern generously provided by Commonsware. https://github.com/commonsguy/cwac-wakeful To get location fixes, I rely on the following code provided by a member called Fedor. What is the simplest and most robust way to get the user's current location on Android? . I slightly modified it to return null instead of getting the last known location They both work perfectly fine when not combined: I can get a location fix from Fedor's class in an Activity, and I can do some

ListView random IndexOutOfBoundsException on Froyo

回眸只為那壹抹淺笑 提交于 2019-11-27 04:04:41
问题 I have an app with tons of downloads and I'm receiving a lot of this error: 16783 AndroidRuntime E java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 16783 AndroidRuntime E at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257) 16783 AndroidRuntime E at java.util.ArrayList.get(ArrayList.java:311) 16783 AndroidRuntime E at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:16 4) 16783 AndroidRuntime E at android.widget.ListView

Sending message to a Handler on a dead thread when getting a location from an IntentService

我的未来我决定 提交于 2019-11-26 12:08:53
问题 My app needs location fixes on regular basis, even when the phone is not awake. To do this, I am using IntentService with the pattern generously provided by Commonsware. https://github.com/commonsguy/cwac-wakeful To get location fixes, I rely on the following code provided by a member called Fedor. What is the simplest and most robust way to get the user's current location on Android?. I slightly modified it to return null instead of getting the last known location They both work perfectly