How to use external library in Android project

by Naveen Krishna Ch » Fri, 30 Oct 2009 13:04:01 GMT


Sponsored Links
 Eclipse provides an option to add the *.jar files in external libraries.

2009/10/29 Sj <soojung_h...@hanmail.net>



-- 
Shine bright,
(: Naveen Krishna Ch :)

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



Other Threads

1. Need to unload driver and restart wpa_supplicant on wakeup from suspend.

All,

Due to a hardware deficiency, whenever I wake up my device from
suspend, my wifi connection status changes to 'disconnected'.  My team
and I have ported several other platforms before to this device and,
for each one, we had to unload my device driver and restart any
services that were associated with it before the connection could be
established.  On our previous iterations, we used apm for power
management which made running a simple script on resume trivially
simple.  With Android, however, it seems that there isn't a reasonable
way to shoe-horn this process in.

My first attempt was to create a broadcast receiver which consumed the
'ACTION_SCREEN_ON' intent and run setWifiEnabled(false); setWifiEnabled
(true); when the intent was seen.  Since these calls don't seem to be
synchronous, I added a 'while(wifiManager.isWifiEnabled())
{Thread.sleep(1000);}' to wait for the first action to run.  (Yes, I
know this is a hack).  This actually WORKED for a hardware suspend
(when I hit the power button on my device) but NOT for a screen
timeout.

After this setback, I started tracing back through the networking code
and found the WifiService.java that seemed to already be consuming the
ACTION_SCREEN_ON intent and doing stuff (albeit apparently
asynchronously with messages).  I have tried several different ways to
get my down / up mechanism to work (in the updateWifiState() and
setWifiEnabledBlocking() methods) but to no avail.  This whole
mechanism seems so interdependent upon itself that adding special
blocks to bring down the driver and supplicant only appear to add
instability and break things.

Can someone who is familiar with this whole mechanism let me know if
I'm even LOOKING IN THE RIGHT PLACE or not?  Ideally, since the
WifiService.java turns on the whole shebang from the persisted state,
I should be able to add some sort of call during the resume to just
unload the driver and stop the supplicant so that everything starts in
a reasonable state.  (maybe in the init.<device>.rc?)

Thanks,
Ben Friedberg

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

2. Graceful handling of SD card removal while application writing to file...

Hi,

I tried to search for a solution to a general problem I am having and
came up empty.  I'm posting the following question in hopes someone
else has come across this and might know the answer and can share it.

I have an application that contains an activity and a service.  The
activity through the GUI connects to the the service and starts a
background process to write data out to the SD card.  The scenario I'm
trying to handle is if the end-user pulls the SD card out during the
background process writes being performed.  I have a broadcast
receiver in my service which is registered and does receive the event
indicating the media has been unmounted.  When my receiver receives
this event, it attempts to interrupt the background writing in order
to stop and clean up.  I'm currently using buffered I/O (not sure if
this is the reason for my problem) and so when the service detects it
needs to stop writing and clean up, it attempts to do so after closing
the open file streams.  The calls to 'close' on my buffered output
streams are failing due to the SD card being removed.  After all the
attempts have failed, the Android runtime is killing any processes
that have open file streams to the SD card and so my process (Activity
+ Service) is going away.  I could place the Activity and Service in
to separate processes such that my activity should survive but service
still punted (restarted on an as-needed basis), but I would rather see
if there's a more graceful way to handle unflushed I/O such that the
process containing my activity and service does not get reaped.

Any thoughts, ideas would be greatly appreciated.

Andy
--~--~---------~--~----~------------~-------~--~----~

3. Full Screen in sub-Preference Screen

4. Force screen orientation and avoid destroy call

5. playing sound on active call

6. Custom list adapter using SQL and line-specific icons

7. Additional fonts for use with Webkit