0
|
It may that something in your view is "on top" of myRelativeLayout. If it is, it's getting the touch event first. The worst part about that is that the default handling of events is to do nothing with the event and then consume it.
One solution would be to add this code onto whatever components of your display are "above" the View (or Layout) that SHOULD handle the event:
The key (obviously) is to return false. When you do that, the event will not be consumed, but rather passed "down" to something in your relative layout -- hopefully somewhere you want it to go.
|
2013年8月19日 星期一
Relative Layout Touch Listener
2013年8月15日 星期四
launchable activities, as they appear in launcher, without duplicates
I am writing an app that allows user to view the list of installed apps, select one of them and then start it on schedule. Using tutorials from stackoverflow i managed to figure out how to get a list of installed activities, their package names and icons(i.e. here - several ways to do it). Just in case, this is how i start activities, it works flawlessly, no problem here:
The problem is with retrieving a list of installed apps. I've found two ways to get a list of installed applications:
1) use
and from each element from
apps you can get it's package name and package label(app names).
2) use
There is a problem with first method: it returns all installed packages, including system services, which may not contain any activity and are therefore not launchable. Here's a screenshot with an example:
All the items above that have no icons are not launchable.
There is a problem with the second approach as well: Several items in the list have duplicates:
When i set up a breakpoint in debugger i see, that these "Maps" items have different activity names ("com.google.android.maps.MapsActivity", "com.google.android.maps.LatitudeActivity", "com.google.android.maps.PlacesActivity" etc.).
I decided to use the second approach, because it gives a list that is more suitable for my needs, but i can't find a way to filter out the duplicates and only show the default activity for the app, as they appear in the Launcher(you only see one 'Maps' in your phone's list of apps, not four). I've tried filtering out system apps through
ApplicationInfo.FLAG_SYSTEM, but this removes many apps that i want to have, including Maps and other preinstalled apps. I've tried usingPackageManager.MATCH_DEFAULT_ONLY flag when executing queryIntentActivities, but this also filters out many apps, leaving just a few.
I'm kinda lost here, and i don't know what to do. I've read all the questions on stackoverflow about retrieving a list of installed apps, but this issue has never been brought up. Please, help anyone? How do i retrieve a list of installed launchable apps that has no duplicates?
| |||
Try this code. It will list out only the applications which are all installed in your device.
| |||||
|
Try below code and let me know what happened.
|
訂閱:
文章 (Atom)
ApplicationInfo.FLAG_SYSTEM, but for some reason this removes many valid apps, including games and such. – Anton Cherkashyn Mar 28 '12 at 17:45