Global search app

by neuromit » Wed, 15 Dec 2010 06:21:00 GMT


Sponsored Links
 I would like to write an application that replaces the dialog that
shows up when you long press the search button. How would I making it
so my app gets launched on a search button long press?

-- 



Re: Global search app

by TreKing » Wed, 15 Dec 2010 06:28:41 GMT


 



Apps get launched (or given as an option to be launched) when they match the
intent being processed. So if you want to be called on a search long press,
start by looking through the documentation for intents related to that and
setting up your manifest to match.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 06:36:03 GMT


 You might try android.intent.action.VOICE_COMMAND, but I don't know if 
that's the right intent for what you want.

-- 



Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 06:49:05 GMT


 I also just saw that android.intent.action.SEARCH_LONG_PRESS exists, so 
maybe that's one you can use too.

-- 



Re: Global search app

by neuromit » Wed, 15 Dec 2010 08:33:34 GMT


 Thanks a million




-- 



Re: Global search app

by neuromit » Wed, 15 Dec 2010 10:49:30 GMT


 ok I added the following lines to the <intent filter> of my manifest
file:
<action android:name="android.intent.action.SEARCH_LONG_PRESS" />
<action android:name="android.intent.action.VOICE_COMMAND"/>

and then I added code to deal with the intents to the appropriate
class.

However when I run test the code I'm never prompted to pick a default
application. Long pressing the search button brings up the voice
search dialog box.

Is there something else I need to specify to say that my application
should be launched on a search button long press?




-- 



Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 11:12:28 GMT


 You may have to go into Settings>Apps>Manage Apps find Voice Search, and 
then clear defaults.

I'm not really sure though. You may also want to try 
android.speech.action.RECOGNIZE_SPEECH< http://developer.android.com/reference/android/speech/RecognizerIntent.html #ACTION_RECOGNIZE_SPEECH>

-- 



Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 11:14:40 GMT


 Also, you may need to add <category 
android:name="android.intent.category.DEFAULT"/>

-- 



Re: Global search app

by neuromit » Wed, 15 Dec 2010 11:23:08 GMT


 thanks for your replies... but I think I need to do something more.

My SMS client (ChompSMS) can be bound to the search button long press
and it doesn't start any sort of voice recognition activity.

When I cleared the default application and long pressed the search
button the dialog appeared offering me which activity to launch it
didn't list mine.

hmm... this is getting a bit frustrating.





-- 



Re: Global search app

by neuromit » Wed, 15 Dec 2010 11:50:30 GMT


 Ahh.. I missed your post where you said to add:
<category android:name="android.intent.category.DEFAULT" />

this indeed fixes the problem!






-- 



Re: Global search app

by Jake Basile » Wed, 15 Dec 2010 12:15:50 GMT


 Cool, glad I could help.

-- 



Re: Global search app

by Bob Kerns » Wed, 15 Dec 2010 14:14:18 GMT


 OK, but now that you've got all that figured out -- are you sure this
is really what you want to be doing? As opposed to extending the
existing search capabilities with a searchable content provider?

 http://developer.android.com/intl/de/guide/topics/search/adding-custom-suggestions.html #QSB

As a user, I would never, in a million years, consider giving up the
Android-provided global search capabilities.  Search is really, really
important.  So unless you're providing a superset of the functionality
which would be a *lot* of work!), I would think that extending the
existing capabilities rather than writing your own app is the way to
go.

If you're thinking of the search key as a shortcut to your
application, I think that's a really, really bad idea.

If your goal is to provide a better search app than the default one --
I hope you know what you're getting into, and wish you the best of
luck! And look forward to trying it out.




-- 



Re: Re: Global search app

by TreKing » Wed, 15 Dec 2010 23:36:54 GMT


 






In all fairness, it sounds like the OP is trying to override the LONG PRESS
of the search key, not the regular press. By default a quick press starts a
search, while a long press starts *voice* search. The average user probably
doesn't even know this exists. (I showed a friend with a new EVO this trick
and blew her mind).

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 



Re: Global search app

by neuromit » Thu, 16 Dec 2010 06:02:03 GMT


 Treking, this is exactly what I'm trying to do.







-- 



Re: Global search app

by Bob Kerns » Thu, 16 Dec 2010 12:04:01 GMT


 Ah. Well, I still think that's a bad idea, unless you're providing an
enhanced superset. While the "average user" might not know it exists
-- they'd probably really like to know it existed.





-- 



Other Threads

1. external/elfcopy/elfcopy.c(1097): gelf_update_phdr(): invalid data

external/elfcopy/elfcopy.c(1097): gelf_update_phdr(): invalid data

This post discuss fix to this issue. Patch also posted.

The issue may cause prelink or strip fail.

What does it do?
When some pieces of code/data is removed, there will be hole in image.
Code/data after hole will be move forward to eliminate hole. Program
header needs update accordingly. Error happens in this phase.
The logic:
Iterate program headers. To a pecific program header, find the first
section that belongs to it. Take the offset of first section as the
new program header offset. delta = new_offset - old_offset. Update
program header entry with delta.
section_to_header_mapping() will get first section offset.  -1 means
no section found belongs to the program header. So, there is no need
to update it. Unfortunately, this condition was not cauptured. Update
will always happen.

The fix is simple. Check return value of section_to_header_mapping().
Do not update when -1

diff --git a/elfcopy.c b/elfcopy.c
old mode 100644
new mode 100755
index ec8d0f3..c6f671d
--- a/elfcopy.c
+++ b/elfcopy.c
@@ -1053,6 +1053,8 @@ void adjust_elf(Elf *elf, const char *elf_name,
                                                   &file_end,
                                                   &mem_end);

+                    if(new_phdr_offset != (Elf64_Off)-1)
+                    {
                     /* Alignments of 0 and 1 mean nothing.  Higher
alignments are
                        interpreted as powers of 2. */
                     if (phdr_info[pi].p_align > 1) {
@@ -1091,6 +1093,7 @@ void adjust_elf(Elf *elf, const char *elf_name,
                          phdr_info[pi].p_filesz);
                     //phdr_info[pi].p_filesz = file_end -
new_phdr_offset;
                     phdr_info[pi].p_filesz = file_end - phdr_info
[pi].p_offset;
+                    }
                 }

                 FAILIF_LIBELF(gelf_update_phdr (newelf, pi, &phdr_info
[pi]) == 0,

I neglect the indent intentionally to make it more understandable in
post:)

After applying this patch, following modules needs rebuild:
  external/elfcopy
  build/tools/apriori
  build/tools/soslim

The fix has not been commit.

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. InstrumentationTestRunner not specified ??

You need to add <uses-library android:name="android.test.runner" />
inside the activity tag.

example:
http://developer.android.com/guide/samples/ApiDemos/tests/AndroidManifest.html

-- Urs








--~--~---------~--~----~------------~-------~--~----~

3. Controlling of wireless hardware

4. Never getting onLocationChanged (in emulator)

5. Clickable Desktop Widget

6. Is it possible to load multiple shared library in Android using NDK

7. How can implement EditText on android app widget