Mark M. | has entered the room |
Mark M. | turned on guest access |
Bruce F. | has entered the room |
Mark M. |
howdy, Bruce!
|
Mark M. |
how can I help you today?
|
Bruce F. |
From Omnibus 0.5: ((StaticFragmentsDemoActivity)getActivity()).showOther(v);
|
Bruce F. |
how does getActivity know which activity to return, if there is more than one?
|
Mark M. |
a fragment instance is only hosted by one activity
|
Bruce F. |
And hello to you too.
|
Mark M. |
just as a widget is only hosted by one activity
|
Apr 26 | 7:30 PM |
Mark M. |
so, getActivity() returns the activity instance that is hosting this fragment instance
|
Bruce F. |
How is the activity showing that it is the host, by referencing the main.xml that contains the fragment?
|
Mark M. |
an activity hosts a fragment either by using a
layout with a <fragment> element, or by executing a
FragmentTransaction that adds one
|
Bruce F. |
thank you
|
Mark M. |
you're welcome!
|
Bruce F. |
One more...
|
Apr 26 | 7:35 PM |
Guille | has entered the room |
Mark M. |
howdy, Guille!
|
Guille |
Hey Mark
|
Bruce F. |
When I run ActionBarDemo in 4.03, with the
actionbarsherlock library (which works on everything else I've tried), I
don't show the tool icons on the bottom, just the textview and edittext
|
Mark M. |
press the MENU button
|
Chris | has entered the room |
Mark M. |
your emulator is probably set up to emulate a device that has a MENU button
|
Mark M. |
which means the ... is suppressed
|
Bruce F. |
thanks
|
Mark M. |
(BTW, howdy, Chris!)
|
Mark M. |
Guille: do you have a question?
|
Chris |
Hey. I'm back after like a 9 month break. I've forgotten everything :)
|
Guille | |
Chris |
My question is probably horrible and hard to give
an exact answer. I'm just looking for general direction. I'm working
on a simple app that is going to have a user pressing a button, a REST
call being made and the UI updated based on the results of the REST
call. I have a mock up where where I create a helper class that sets up
the http client and kicks off an AsyncTask to perform the REST call and
updates the UI. I want to eventually get it where I can create some
sort of helper object that lets me perform http puts, gets, etc on a url
and provides me the results. Based on this, I wanted to see if you had
a recommendation on what approach I should take. I'm aware of threads,
AsyncTask, Handler and Binder.
|
Mark M. |
(Guille: sorry, will get to you after Chris, I guess)
|
Guille |
no problem :)
|
Apr 26 | 7:40 PM |
Mark M. |
Chris: if your request needs to happen regardless
of what the user does at the UI layer, have the request be processed by
an IntentService, so it runs independently of your activities
|
Mark M. |
otherwise, an AsyncTask is my preferred choice
|
Chris |
Oh yeah I forgot about IntentService
|
Chris |
I'll look into that. Thanks.
|
Mark M. |
Guille: your turn now, honest
|
Guille |
I have a question about a situation i had and want
some validation on what i found. I was noticing that the Total size of
my app was growing on my phone every time i updated a row in my
database. What I noticed was that i wasn't closing the database
connection on some occasions. would that make the total size of my app
grow? closing the connection seems to have fixed it. btw, by size i mean
the Total in MB not the Application or Data.
|
Mark M. |
since nothing is cached in SQLiteDatabase (as far as we know), I would find that somewhat surprising
|
Mark M. | |
Guille |
nope, but only because I dont know how to :)
|
Mark M. |
oh, wait
|
Mark M. |
are you referring to RAM or on-flash storage size?
|
Guille |
it is possible, i am referring to the size that
you see when you look the app on Settings -> Application ->
<Application>
|
Mark M. |
that would be on-flash storage
|
Apr 26 | 7:45 PM |
Mark M. |
SQLite is transactional, so I would not expect
holding a SQLiteDatabase open to keep any files around that would get
cleaned up once you close it
|
Mark M. |
however, that gets into SQLite's own implementation, and I'm far from expert on that
|
Guille |
cool, oh well it seems to be working now, so i guess cross my fingers! :)
|
Mark M. |
Bruce: do you have another question?
|
Bruce F. |
no thank you
|
Mark M. |
OK, if anyone has a question, chime in
|
Guille |
ok I have another one
|
Mark M. |
go ahead
|
Guille |
back to database stuff. this error has only happened once. unfortunately for me it happened to my client
|
Guille |
java.lang.IllegalStateException: The content of
the adapter has changed but ListView did not receive a notification.
Make sure the content of your adapter is not modified from a background
thread, but only from the UI thread. [in ListView
|
Guille |
This happened while installing the app on the phone
|
Mark M. |
that's impossible
|
Mark M. |
none of your code runs while installing the app on the phone
|
Guille |
ok maybe I need to get more details then
|
Guille |
hmm let me describe the process might give a better idea
|
Mark M. |
that error could certainly occur when the user ran your app
|
Guille |
So maybe it happened right after install and when it was starting
|
Guille |
because the first page is a list of companies
|
Mark M. |
one cause would be because you did a requery() on a
Cursor from a background thread, where that Cursor was attached to a
ListView via a CursorAdapter
|
Apr 26 | 7:50 PM |
Guille |
I am using a custom SimpleCursorAdaptor but i dont requery() anywhere
|
Mark M. |
something in a background thread tried doing something that caused the SimpleCursorAdapter to think data changed
|
Guille |
Yeah, when the user opens the app, onCreate it
call a IntentService to update the database. But no where do I try to
update the screen with the new data.
|
Mark M. |
:: shrug ::
|
Mark M. |
beats me, then
|
Guille |
jajaja
|
Guille |
ok thanks for your help!
|
Mark M. |
you're welcome!
|
Mark M. |
if anyone has a question, chime in
|
Bruce F. |
Running your 0.5 code, I've gotten a couple of
strange xml errors, because they reference things that aren't in the
xml. For example, with editor.xml in ViewPagerFragmentActivity, I'm
getting a failure to resolve a color value in textColor, when there is
no text in the xml.
|
Mark M. |
textColor is not set in editor.xml
|
Mark M. |
nor is it modified within EditorFragment
|
Mark M. |
hence, I have no idea what you are seeing
|
Mark M. |
can you take a screenshot?
|
Apr 26 | 7:55 PM |
Mark M. |
(one that shows the error message and location?)
|
Bruce F. |
View paste
|
Mark M. |
BTW, I am assuming this is a compile-time error
|
Mark M. |
ah, that's in ActionBarSherlock
|
Mark M. |
make sure your build target for the project is API Level 14 or higher
|
Bruce F. |
<uses-sdk android:minSdkVersion="15" />
|
Mark M. |
no, your build target
|
Mark M. |
Project > Properties > Android
|
Bruce F. |
Android 4.0.3 is the only one checked
|
Bruce F. |
actionbarsherlock works fine elsewhere
|
Mark M. |
well, that should be fine
|
Mark M. |
try Project > Clean and see if that helps
|
Bruce F. |
already tried, I'll let you move on
|
Bruce F. |
thank you
|
Mark M. |
again, if anyone has a question, chime in
|
Apr 26 | 8:00 PM |
Bruce F. |
Same project as before. It doesn't compile because it doesn't generate R.java
|
Mark M. |
that is because of that error
|
Mark M. |
that error is usually caused by the build target being wrong
|
Mark M. |
I have never seen that error in any other circumstance
|
Mark M. |
if the other projects work fine, you will need to
poke around and try to figure out what is wrong with that one project's
configuration
|
Bruce F. |
yep, that fixed it
|
Bruce F. |
I was looking at the wrong properties before.
|
Mark M. |
ah, OK
|
Apr 26 | 8:10 PM |
Mark M. |
again, if anyone has a question, just ask
|
Apr 26 | 8:25 PM |
Mark M. |
we're running out of time -- any last questions?
|
Apr 26 | 8:30 PM |
Bruce F. | has left the room |
Mark M. |
OK, that's a wrap for today's chat
|
Guille |
thanks mark
|
Mark M. |
next one is Tuesday, 10am Eastern Time
|
Mark M. |
have a pleasant day, all!
|
Guille | has left the room |
Chris | has left the room |
Mark M. | turned off guest access |