[android-developers] Can you requery a Cursor after the database object that created it is closed?

2009-03-15 Thread iliketolearn

>From my own quick tests, this seems to be the case. I just wanted to
confirm.

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Can you requery a Cursor after the database object that created it is closed?

2009-03-17 Thread iliketolearn

Any help is appreciated.

On Mar 15, 8:06 pm, iliketolearn  wrote:
> From my own quick tests, this seems to be the case. I just wanted to
> confirm.
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Strange Cupcake Memory Bug with WebViews (that disappears when debugger attached)

2009-05-15 Thread iliketolearn

I've literally spent 15+ hours trying to figure out this one bug (when
I should be studying for finals). Any help is greatly appreciated. The
bug appears on the dev1 phone running cupcake. It was not present
before the upgrade. Basically, the problem is that when a activity
with a webview and 2 threads is run, the service that runs after it
will always crashes the process (but it works fine when the debugger
is attached). The worst part is that it crashes at arbitrarily places
in the service, so I can't isolate the error.

The details:

I have an activity with a WebView. The activity executes two threads,
one after the other using the basic new Thread(new Runnable() {public
void run()...  Both threads use the same handler to report back
results to the main activity. Flow works like this: when the activity
starts, the first thread gets data to construct the URL that the
webview will load (using DefaultHTTPClient). Then when the user
navigates to a certain page, the second thread is again fired (using
DefaultHTTPClient) to get some xml. This works fine.

The problem happens right afterwards. Once the activity with the
webview finishes (it calls finish on itself), a service is started
that has a thread that using DefaultHttpClient to downloaded some xml,
process it, etc. The service crashes at arbitrary points with no error
messages, simply displaying a memory dump, and kills the main process
with it. When I attempt to debug the process, it runs just fine w/ no
crashes. I've repeated this at least 30 times, with the same result.
(no crash w/ debugger, crash when installing signed apk file to device
and running it).

The program doesn't crash when the threads are removed from the
activity with webview. So even if the webview activity runs (but all
threads are removed), the service runs just fine regardless of the
debugger.

Here is how my threads start (both of the ones in the activity with
the webview, and the main thread in the service that is launched
afterwards):

Thread t = new Thread(
new Runnable() {
public void run() {
try {

final HttpParams params1 = new BasicHttpParams();
HttpProtocolParams.setVersion(params1, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params1, "UTF-8");
final SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));
final ThreadSafeClientConnManager manager =
new ThreadSafeClientConnManager(params1, registry);
 DefaultHttpClient client = new DefaultHttpClient(manager, params1);

.

Here is what logcat displays:

05-15 05:00:03.561: INFO/DEBUG(1022): Build fingerprint: 'android-
devphone1/dream_devphone/dream/trout:1.5/CRB21/147201:userdebug/
adp,test-keys'
05-15 05:00:03.571: INFO/DEBUG(1022): pid: 2540, tid: 2541  >>>
com.macrospecs.friendmobilizer <<<
05-15 05:00:03.571: INFO/DEBUG(1022): signal 11 (SIGSEGV), fault addr
0140
05-15 05:00:03.571: INFO/DEBUG(1022):  r0 0007  r1 0001  r2
411989b4  r3 0140
05-15 05:00:03.571: INFO/DEBUG(1022):  r4 411989b4  r5 000f7418  r6
  r7 0016e170
05-15 05:00:03.571: INFO/DEBUG(1022):  r8 100ffd00  r9 4100aef0  10
4100aedc  fp 0001
05-15 05:00:03.582: INFO/DEBUG(1022):  ip 0011  sp 100ffc48  lr
ad046ca5  pc ad03ed9a  cpsr 0030
05-15 05:00:03.681: INFO/DEBUG(1022):  #00  pc 0003ed9a  /
system/lib/libdvm.so
05-15 05:00:03.691: INFO/DEBUG(1022):  #01  pc 0026d0ce  /
system/lib/libwebcore.so
05-15 05:00:03.691: INFO/DEBUG(1022):  #02  pc 0026d250  /
system/lib/libwebcore.so
05-15 05:00:03.701: INFO/DEBUG(1022):  #03  pc e3b4  /
system/lib/libdvm.so
05-15 05:00:03.711: INFO/DEBUG(1022):  #04  pc 00040a8a  /
system/lib/libdvm.so
05-15 05:00:03.711: INFO/DEBUG(1022):  #05  pc 00013118  /
system/lib/libdvm.so
05-15 05:00:03.711: INFO/DEBUG(1022):  #06  pc 00017b1c  /
system/lib/libdvm.so
05-15 05:00:03.721: INFO/DEBUG(1022):  #07  pc 00017560  /
system/lib/libdvm.so
05-15 05:00:03.721: INFO/DEBUG(1022):  #08  pc 000520ec  /
system/lib/libdvm.so
05-15 05:00:03.731: INFO/DEBUG(1022):  #09  pc 0005210a  /
system/lib/libdvm.so
05-15 05:00:03.731: INFO/DEBUG(1022):  #10  pc 000494c4  /
system/lib/libdvm.so
05-15 05:00:03.741: INFO/DEBUG(1022):  #11  pc 0004954c  /
system/lib/libdvm.so
05-15 05:00:03.741: INFO/DEBUG(1022):  #12  pc 00049896  /
system/lib/libdvm.so
05-15 05:00:03.751: INFO/DEBUG(1022):  #13  pc 00046f6a  /
system/lib/libdvm.so
05-15 05:00:03.751: INFO/DEBUG(1022):  #14  pc f880  /
system/lib/libc.so
05-15 05:00:03.761: INFO/DEBUG(1022):  #15  pc f3f4  /
system/lib/libc.so



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To u

[android-developers] Touch Mode Won't Clear on ListView Item Tap (possible Bug)

2009-12-23 Thread iliketolearn
I've spent 3 days trying to figure this out to no avail. I've spent
hours weeding through Android source code. Hopefully someone can shed
some light.

My listview uses custom views for the rows. When the application first
loads, the listview is populated using a DB cursor and all works well
(list items are all selectable by tapping on them). However, when the
cursor is changed and notifyDataSetChanged() is called, the new rows
are no longer selectable by tap - no matter how many times I tap on
them. I can't seem to get out of touch mode. (Note that each rows'
onTouchEvent method is being called) The only way to select the rows
is to use the track ball. After the trackball is used once, and only
then, I can select items by tap (ie, clear touch mode) just as
before.

I've managed to reproduce this problem multiple times on the Android
Dev 1 (G1) device. Similar issues also occur when screen orientation
is changed. Sometime, if I change the screen to landscape, I won't be
able to select row items by tapping.

Any ideas what could possibly cause this? I've studied the source of
ListView.java and still can't figure out the problem.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Touch Mode Won't Clear on ListView Item Tap (possible Bug)

2009-12-23 Thread iliketolearn
In both cases, the status of the individual row views seems to be the
same: they are not focusable, they are not selected, they are not
focusable in touch mode, they are shown, and save is enabled.

I can't seem to find any differences between the two states (when tap
will exit touch, and when it will not).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Parsing Speed: Reading InputStream vs. Converting InputStream to String

2009-07-23 Thread iliketolearn

I'm downloading text data from a web server, and getting an
InputStream. The data will be relatively large and delimited. I want
to split this data by the deliminator and store each piece in the DB.

 Is it faster to read the InputStream byte by byte to split the data
and store each piece in the DB, or would it be faster to convert the
InputStream to a String and use an existing function such as Split?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Parsing Speed: Reading InputStream vs. Converting InputStream to String

2009-07-23 Thread iliketolearn

Wow, this question went straight to the second page. This forum has
really been growing rapidly.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Threads, Message Queue, and Loopers

2009-01-01 Thread iliketolearn

I have a few questions and points of clarification. Any help is
appreciated.

1) Does each thread have it's own message queue? Does each process
have it's own message queue? Or, is there simply 1 global system
message queue?

2) If there are in fact multiple message queues, when there is a
System event (e.g. intent being broadcasted) or UI event (key press),
into which message queue do these events inject entries?

3) If there is a single message queue for the OS and multiple APK's
installed and running, does only one Looper operate on the queue at a
time?

4) When/Why would you create a Looper for a child thread?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] When to put a service into a separate process?

2009-01-12 Thread iliketolearn

At one of the Android Google IO sessions, Dan Morrill mentioned that
it would be rare to need to do so, without providing much more info.
Also, the posts from Google/Android employees in this forum don't
recommend doing this either, often citing "overhead." The official
android documentation doesn't seem to grace this topic, and
consequently I've been left with the same question: When would you
need to put a service into a separate process?

For my specific application, I need to communicate with a remote
server every 30 minutes downloading some XML each time, dissecting it,
and displaying notifications. I thought it would be a good idea to put
this service in it's own process to completely separate it from the UI
process. The reason being, the service process is a lot more light
weight than the process with all my activities. It seems that it would
be easier on the OS to keep the lighter service process constantly
running/executing, and the OS could kill off the heavier process with
all the activities when they aren't being used. Otherwise, if I put
the service in the same process as the rest of my application, the
system would need to keep this massive process (containing various
views, activities, and a service) around continuously - something very
inefficient. Is this the correct line of thinking? Or should I keep
everything in 1 process?

Thanks for your time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Activity Lifecycle in Regards to Process Lifecycle and GC

2009-01-13 Thread iliketolearn

After reading the Android Activity documentation, I'm still a bit
confused on Activity Lifecycles. Clarification on the two points below
would be greatly appreciated.

When the system is running low on memory, can it selectively choose to
destroy an activity in the process, instead of the entire process? For
example, if a process has a service and a non-visible activity running
within, does the OS destroy only the activity, letting the process
with the service continue to live? Or, should I assume that when the
OS destroys an activity, it destroys the entire process?

Also, when an activity is destroyed (either by calling finish() or by
the system), does everything get GC'd regardless if the variables are
public, private, static, etc?

Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity Lifecycle in Regards to Process Lifecycle and GC

2009-01-13 Thread iliketolearn

Thanks Dianne, as usual your responses are prompt and helpful.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---