Office Hours — Today, October 15

Monday, October 13

Oct 15
3:50 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:00 PM
EGHDK
has entered the room
Mark M.
hello, EGHDK
how can I help you today?
EGHDK
If I have an arrayadapter and its backed by an array, and I call datasetChanged what actually happens?
Because I'm updating my array and calling dataSetChanged but not seeing a change.
Mark M.
do you mean notifyDataSetChanged()?
and by "array" do you mean an ArrayList?
EGHDK
Yes and Yes
Mark M.
notifyDataSetChanged() tells the AdapterView to reload its contents from the Adapter
if you are not seeing changes, make sure that you are affecting the actual ArrayList that the ArrayAdapter wraps
or, use the add(), insert(), and remove() methods on ArrayAdapter
EGHDK
Alright. Will do.
Mark M.
which both modify the ArrayList *and* do a notifyDataSetChanged() for you
4:05 PM
EGHDK
Okay, next qquestion might be a little weird, but I was using your camera library in my eclipse project.
I believe I was using a 0.5 or 0.6 version or something.
Mark M.
current is 0.6.10
EGHDK
I switched from using eclipse to Android studio and it complained about multiple package names or something because I had camera and camerav9
Ron B.
has entered the room
Mark M.
with Android Studio, you wouldn't use JARs, but rather grab the artifacts from the repository
in which case, just asking for camera-v9 will pull in the camera artifact
(hello, Ron -- I will be with you momentarily!)
Ron B.
Hi Mark,
EGHDK
So I tried that, but it broke my app because it says that you can only have video in portrait or something.
Mark M.
the library does not support video recording in portrait
EGHDK
So I'm trying to use the old library. Any way to grab that from the repo?
Mark M.
put that editions version number in the compile directive
but portrait recording is buggy, and I do not recommend it
EGHDK
Okay
I will use it, but I will take note of that.
Mark M.
Ron: your turn! do you have a question?
Ron B.
I have an app that displays a map on all of my devices except my Samsung 10" tablet? Is there some setting or something else I should be looking for? It just displays a white screen.
Mark M.
Maps V2?
Ron B.
Yes
Mark M.
does the regular Maps application work on the tablet?
4:10 PM
Ron B.
Yes
Mark M.
anything interesting in LogCat?
Ron B.
Haven't dug too deep yet, just happened to coincide with office hours :-). Does anything sound familiar?
Mark M.
not really
if it works on one device and not another, that's usually more of a device issue
for example, it might not be up on the latest Play Services or something
but that should pop a dialog when you check for Play Services compatibility
Ron B.
Yeah, I did check the play store version, it's OK
Mark M.
so, I'd rummage around LogCat and see if there is anything interesting showing up in there
Ron B.
Do maps not like to display on a large screen without some other setting...?
Mark M.
no, there's no problems thre
er, there
now, I can't rule out something broken in your UI (e.g., you have a white thing floating over your map)
Ron B.
OK, I'll keep diggin.. Thanks anyway
Mark M.
that only happens to show up on tablets
EGHDK: your turn! do you have another question?
EGHDK
View paste
    compile('com.commonsware.cwac:camera-v9:0.6.+') I can just put in the version number I want there? Like this:     compile('com.commonsware.cwac:camera-v9:0.5.+') {? Sorry I'm not super familiar with gradle yet.
Mark M.
yes, or replace the + with a specific patchlevel
4:15 PM
Mark M.
0.5.+ says "gimme the highest patchlevel of the 0.5.x series"
EGHDK
oh. That seems easy enough
Mark M.
0.5.1 says "gimme 0.5.1"
EGHDK
And that makes sense. Thanks.
Mark M.
Ron: your turn! do you have another question?
Ron: if you come up with a question, let me know
EGHDK: back over to you, if you have another question
EGHDK
So it turns out my array my adapter is using is not being directly edited. Its more like 1 array is being updated, then that one updates another 1. Whats your advice in that kind of perdicament? Besides the obvious "just use one array, and only modify that one"?
Mark M.
I'd stick with the obvious :-)
4:20 PM
EGHDK
Damn. Alright. Worth a try.
Mark M.
having multiple collections without clear roles for them can get you in trouble, as it would appear is happening here
EGHDK
They do have clear roles.
Mark M.
what are the roles?
EGHDK
Well one is basically a db helper and another array is just a filtered list from the db
Mark M.
what does "basically a db helper" mean?
do you mean some sort of cache of Plain Old Java Objects (POJOs) that you created based on a database query?
EGHDK
Yeah
Exactly that. (So thats what pojos are)
Mark M.
then if you update the master copy ("basically a db helper"), you need to ensure everyone working off of a separate subset of that master ("filtered list from the db") knows about changes
EGHDK
Okay. Makes sense.
View paste
My last issue I believe here will be that my project worked fine on 2.3 devices. I went to android studio, and now it doesn't. I get an error message thats somewhat cryptic "Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error).
In order to proceed, you have to uninstall the existing application.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?"
Mark M.
that's... different
4:25 PM
Mark M.
I haven't seen that message before
4:25 PM
EGHDK
This happens even though the application isn't even installed.
Mark M.
EGHDK
What if proguard isn't an option.
Mark M.
get rid of some libraries, perhaps
the post there indicates that this is another side effect of the 64K DEX method reference limit
which basically boils down to "you're using too many libraries for Android to handle"
EGHDK
bah. How is that possible. Isn't the 64k dex limit on all android versions?
How does it work on 4.0?
Mark M.
normally, it's a compile-time limit -- you usually crash at build time
EGHDK
?
Mark M.
actually, re-reading the answer, the developer didn't hit the 64K DEX method reference limit, but still had a too-big APK file, presumably based on code volume
EGHDK
Normally its compile time... but "you usually crash at build time". Isn't that the same thing?
Mark M.
yes
4:30 PM
Mark M.
I misinterpreted the SO answer -- the developer there did not hit the 64K DEX method reference limit, but hit some other limit ("the buffer", whatever that is)
and reducing the size of the app helped
EGHDK
Interesting. Okay.
So in Androisd studio... I have camera and cameraV9 module in my project tree.
Mark M.
(BTW, Ron, if you have another question, chime in)
EGHDK
View paste
But I have compile('com.commonsware.cwac:camera-v9:0.6.+') {
        exclude module: 'support-v4'
    }
Do I basically have two instances of them now?
Mark M.
two instances of what?
Ron B.
Yup, I see a message that coincides with an entry in StackOverflow. http://stackoverflow.com/questions/8463731/andr...
EGHDK
or since the camera v9 and camera libraries aren't used, they don't get compiled/bundled in with my app?
Mark M.
libraries are compiled in
ProGuard might remove them for release builds, if you're not using them
EGHDK
Mark: so if I don't include `compile project(':cameraV9')` then it shouldn't be bundled in with my app right?
Mark M.
correct -- Android Studio does not pull in libraries that it does not know about
4:35 PM
EGHDK
It might be how android studio opened my eclipse porject and then tried to include all my dependencies.
Mark M.
possibly
EGHDK
I have compile project(':mergeAdapter') the : means that its coming from my local project and not a repo somewhere right?
Mark M.
yes, from your mergeAdapter/ module
EGHDK
Okay, so where is compile 'com.android.support:support-v4:18.0.0' coming from?
Is that getting pulled from google? Because I don't see that module anywhere
Mark M.
either you have a compile directive for it, or you are using a library that has a compile directive for it, or you are pulling in the JAR from libs/ with a compile fileTree() directive, etc.
4:40 PM
EGHDK
So its not pulling from the web is what your saying?
Mark M.
well, for that particular library, it will come from your Android Repository that you installed in the SDK Manager
which is local to your machine, in your SDK directory
EGHDK
okay.
Mark M.
compile directives citing an artifact by name (e.g., compile 'com.android.support:support-v4:18.0.0' ) will pull from some repository
usually, that repository is a hosted one, like Maven Central
in the case of the Android Support libraries and the Play Services SDK, they come from local repositories set up by the SDK Manager
EGHDK
View paste
Whats the difference between     compile 'com.android.support:support-v4:18.0.0' and compile 'com.android.support:appcompat-v7:19.+'  that Cwac camera wants? Should I use the cwac camera one because its a newer version?
Mark M.
I do not depend upon appcompat-v7
beyond that, support-v4 and appcompat-v7 are separate libraries
EGHDK
Oh. Okay.
4:45 PM
EGHDK
So for support-v4 I'm getting a redline under it. "Should not use lower version 18 than sdk target (19)
Is that an issue since cwac camera asks for 18?
Mark M.
no, it should be OK
I probably need to figure out a more flexible approach to declaring that dependency
Ron B.
Are you ready for me yet? I sent a link above, Google maps has no problem with the gsm signal not being there.
Mark M.
Ron: whoops! sorry, missed that in the transcript
EGHDK
Sorry Ron!
Ron B.
NP, bad timing on my part :-)
Mark M.
Ron: I can't imagine that those messages would result in an empty map
Ron B.
There are error messages. The marker and accuracy circle are there.
Mark M.
so, you're missing the tiles
4:50 PM
Mark M.
I don't see how that error message would tie into not getting tiles
Ron B.
I guess you could say that
Mark M.
on a whim, you might try running one of my Maps V2 samples on the tablet, switched to your own API key
if that works, perhaps there is something in your app that is confounding matters on this table
er, tablet
if it does not work -- and that would be my guess -- then I haven't the foggiest notion what the problem would be
though, FWIW, not having the right API key results in this set of symptoms, so make sure you're running the same APK on the phone and the tablet
for example, if your applicationId is different in one, you'd need to set up your Maps API key to support both applicationId values
Ron B.
I am trying to put buttons and text on top of the map. It's also Android V4.0.4, which is the only device of it's type. It runs on 4 other devices, though I am in the debugger right now.
Mark M.
EGHDK: regarding your last topic, if you have the { exclude } stuff for that camera-v9 dependency, as you pasted into the chat earlier, you should be able to request a newer support-v4 edition to make the tools happy, and camera-v9 should not care
4:55 PM
Mark M.
Ron: 4.0.4 is a bit long in the proverbial tooth, though I would expect other symptoms if age were a problem (e.g., dialog about not having the right Play Services Framework installed)
Randall M.
has entered the room
Mark M.
hello, Randall!
Randall M.
Hi Mark.
Mark M.
Randall: the chat is only a couple of minutes from ending -- do you have a quick question?
Randall M.
Ah, time zones...grr.
Yes, and it's probably a quick one.
Ron B.
Would Google maps work OK and not an app if there is a problem with play services?
Randall M.
Variable-height ListView TableRows? Is it just a matter of providing a custom view of the correct height (sized to a wrapping text label)?
Mark M.
Ron: yes, if the app is requesting a version of Play Services that happens to be there, and you're asking for a newer one
Randall: go ahead
Randall: well, ListView rows overall are usually wrap_content, so as long as your content is tall enough, you're fine
not sure about using TableRow in a ListView row, though
with no TableLayout in the picture, I'm not sure you're gaining anything
Randall M.
Grrr, meant TableLayout.
5:00 PM
Randall M.
sorry, trying to type quickly, since I mis-timed this.
Mark M.
so, a TableLayout in ListView rows?
EGHDK
One more thing mark... where do you think: compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' is coming from? I had it downloaded and in eclipse as a lib, but when I went to android studio, I don't see it in my project tree.
Mark M.
EGHDK: *that* is coming from camera-v9, because the point behind camera-v9 is to use ActionBarSherlock
Randall M.
yeah, I have a list of Table of Contents strings, and some need to wrap to a second line. I don't want all rows to have multi-line heights, just those that need it.
Would also like the wrapped line to be indented, a hanging indent, I think it's called.
If this is too involved, I'll come back on Friday for your office hours.
Mark M.
Randall: I don't completely follow your use case, but if you set the ListView row to have a height of wrap_content, then you control the height of the row and can use things like stretchColumns/shrinkColumns in a TableLayout to help manage it
in terms of a hanging indent, that could get tricky
off the top of my head, I don't know how I would have a paragraph in a single TextView with a hanging indent
if you are splitting the text across multiple TextViews, and you want the top one to stick out more on the left than the others, there are a few options for that, such as using your TableLayout and having the hanging TextView span two cells or something
5:05 PM
Mark M.
or GridLayout might give you more choices, instead of TableLayout
but, I really do need to get going
the next chat is Friday at 4pm US Eastern Time
this chat's transcript will be posted to http://commonsware.com/office-hours/ shortly
Randall M.
Thanks. I've adjusted my calendar notice to reflect the time zone difference.
Mark M.
have a pleasant day!
EGHDK
has left the room
Ron B.
has left the room
Randall M.
has left the room
Mark M.
turned off guest access

Monday, October 13

 

Office Hours

People in this transcript

  • EGHDK
  • Mark Murphy
  • Randall Meadows
  • Ron Bruckman