Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
jkyuusai
Jun 26, 2008

homegrown man milk
Tutorial Site Review:

So I've been using the tutorials on this site:

http://mobile.tutsplus.com/category/tutorials/android/

(as well as the ones found in the OP) for muddling through various bits of the Android platform over the past couple of weeks. The site above is good in the sense that it sometimes offers a more fleshed out description of what's going on in a particular piece of code versus say, Vogella's material. However, it's become apparent as I've gone through more and more of their material that the error rate in their code examples is kinda high. And not just silly dangling semicolons, but actual poo poo that the developer guide explicitly tells you not to do. I was clued into a lot of this by just reading the comments on a given tutorial. In most of the cases, the original authors responded and confirmed the errors. Unfortunately, their solution was to fix the linked source code, but not the erroneous code in the actual tutorial. :psyduck:

So, good descriptions, but beware the code examples, especially if they're not matching up with something you saw elsewhere.

Adbot
ADBOT LOVES YOU

jkyuusai
Jun 26, 2008

homegrown man milk

Doctor w-rw-rw- posted:

^ We should probably update the op sometime soon. Which tutorials have you found the most useful, and for what?


There's more, but recently, these have seen the most use.

VG - Vogella
MT - mobile.tutsplus

Intro to Intents:
VG: http://www.vogella.com/articles/AndroidIntent/article.html

Intro to Fragments:
MT: http://mobile.tutsplus.com/tutorials/android/android-sdk_fragments/
VG: http://www.vogella.com/articles/Android/article.html#fragments

Making Fragments Backwards Compatible:
MT: http://mobile.tutsplus.com/tutorials/android/android-compatibility-working-with-fragments/

Implementing Content Providers:
MT: http://mobile.tutsplus.com/tutorials/android/android-sdk_content-providers/ (ignore the use of managequery, just skip to the next tutorial when you hit that section)
VG: http://www.vogella.com/articles/AndroidSQLite/article.html

and the next in the same series

Accessing Content Providers, The Right Way:
MT: http://mobile.tutsplus.com/tutorials/android/android-sdk_loading-data_cursorloader/

Confusingly, both sets of tutorials sometimes seem to like to initially implement things using deprecated methods or in just plain bad ways. They try to justify it by saying that doing so simplifies things and should help you pick up the material faster. I always felt like it just made things worse because I was always afraid of picking up bad coding practices and wasn't sure what I could trust to be right. Thankfully, they usually at least tell you when they're doing that. If in doubt, Google it. 99% of the time, someone has already asked about it on SO.

edit:

Additionally:

An Explanation of Loaders and Why They're Our Friends (Read this after going through the content provider material)
http://www.androiddesignpatterns.com/2012/07/loaders-and-loadermanager-background.html

edit 2: Actually, I just skimmed the blog in the link above and it looks like it has a decent amount of good content.

jkyuusai fucked around with this message at 19:45 on Dec 11, 2012

jkyuusai
Jun 26, 2008

homegrown man milk
edit: May have jumped the gun on this question/rant. Will do some more research first. Sorry guys! :downs:

Okay, this is dumb. Anyone been successful invoking the camera from an app and storing the resulting (full size!) photo in their app's data directory?

It seems like there's a stupid number of different approaches, and so far all the ones I've tried have crashed and burned.

edit2: Okay, I figured it out.

I was trying to start the camera from an intent inside my app, capture an image, and save it to a directory inside my app. In testing, I was able to get to the point of hitting the button to confirm an image to save, but then the camera would just sit there. After canceling out of the camera, it would return to the app, but the image wouldn't display. Upon checking out the directory, I would find an empty image file where the picture should have saved.

The issue was that when I was creating the file to be used as part of the MediaStore.ACTION_IMAGE_CAPTURE intent, the file's mode by default is set to MODE_PRIVATE which makes the file only editable by the originating application. So, when the camera would take a picture and try to save it, it would silently fail because it didn't have rights to write to the file URI I'd provided it. By overriding this and setting it to MODE_WORLD_WRITEABLE, the camera now had rights to write to the file and everything worked like I expected. After reading some more upon encountering this issue, I'm surprised setting that mode is all it took to allow the camera to write there, since it seems the app directories are supposed to be locked down pretty tight.

My reasoning for saving images to the app directory is that there's no real need (that we can see) at this time to display them as part of the user's gallery, and we also figure a user probably wouldn't WANT them to be shown there in most use cases. Saving them here keeps them out of the gallery, and also lets us have an easier time of managing disk space.

jkyuusai fucked around with this message at 16:33 on Dec 20, 2012

jkyuusai
Jun 26, 2008

homegrown man milk

5436 posted:

Which IDE do people generally prefer? Eclipse or IntelliJ IDEA?

My work uses Eclipse, so that's what I'm familiar with, but I bought IntelliJ in the sale and am planning to give it a go. I'll report back once I've had some time to try it.

jkyuusai
Jun 26, 2008

homegrown man milk
I've had to rediscover this for the third time or so, so I'm documenting it here.

How to attach Source/Javadocs in Eclipse for those pesky jars in your libs folder
http://stackoverflow.com/questions/9873152/how-to-attach-javadoc-or-sources-to-jars-in-libs-folder

Two things to watch out for:
Stick the sources and docs in a sub folder in libs (like /libs/docs) so that they're ignored and not bundled with your apk.
The properties file has the same exact name as the jar including the .jar extension with a .properties tagged on the end. (gson.jar = gson.jar.properties)

How to attach Android Sources in Eclipse
Up to API 14 - Install Android Sources plugin from this update site and restart Eclipse - http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/
More info here - http://code.google.com/p/adt-addons/

Sources for 15 and up - They're included as part of the SDK package, but you still have to link them in Eclipse. Make sure you downloaded the source through the SDK manager, then F3 on something and hit the Attach Source button. Select External Folder, and browse to the sources folder, highlight the proper android-** folder inside and hit open. Boom! Maybe restart if it's misbehaving.

jkyuusai
Jun 26, 2008

homegrown man milk
FYI, someone has the latest release of AQuery set up in Maven Central now and is offering to help keep it current. (Maven is wacky, but we use it at work, so....)

Just set it up in my current project - works like a charm! Now to clean up all these loving calls to findViewById :suicide:

jkyuusai
Jun 26, 2008

homegrown man milk

Karthe posted:

Why the hell is Eclipse now bitching that R can't be resolved? I renamed my application package in AndroidManifest.xml, updated all of my class package names by hand, and cleaned the project, and now Eclipse can't resolve R in two classes...all of my other classes seemed to have figured things out, so why the hell aren't these two other classes getting along? I've even created a whole new Android project and took to recreating the files individually, but Eclipse still wants me to add import my.application.R to the top of these classes. :argh:

I've commonly experienced this issue when I make a mistake in a layout XML file, but literally nothing changed during the rename except for the package name in the manifest and at the top of my class files. Is Eclipse really this lovely?

Especially with Android, it seems like poo poo gets real weird with automagic renaming of stuff via Eclipse. I quit using the convenience "New Android Layout/Activity/Fragment" bullshit after having my manifest file get thoroughly hosed by it more than once. I'm not terribly surprised it didn't catch a few import statement changes. I spent 30 minutes trying to figure out an R file issue one time, only to realize I had ctrl+shift+O'd and somehow Eclipse decided to import android.R instead of my own R file. :shepicide:

jkyuusai
Jun 26, 2008

homegrown man milk
We had some deadlines move around and after some begging, the I/O team allowed my company to transfer one of our two I/O registrations to me. :toot:
So many sessions being done by people who I've been getting great information from since starting my journey in Android over the last year or so. I'll do my best to come back after the conference and point out any that seemed useful.

jkyuusai
Jun 26, 2008

homegrown man milk
Oh my god this android studio demo is amazing.

jkyuusai
Jun 26, 2008

homegrown man milk

Sereri posted:

Hello intelliJ, get hosed eclipse

Hmm how will this affect intellij's monetization? I assume Google isn't going to charge for AS.

Also, new service to translate apps, and alpha/beta testing from the Dev console.

jkyuusai fucked around with this message at 17:39 on May 15, 2013

jkyuusai
Jun 26, 2008

homegrown man milk

Salvador Dalvik posted:

I'm curious what the relationship is here. If this is Google working with Jetbrains, then all this stuff will just end up in the full version.

If they are just forking the community version and none of it will end up in the full version I'll be pretty annoyed.

In ADT panel. Jet brains CTO is speaking now. Based on what he's saying, i think, all the work in android studio will make it back to all versions of intellij.

jkyuusai
Jun 26, 2008

homegrown man milk
Also they spoke at the qa after the panel about someone that is working on plugging okhttp into volley. This would give the side benefit of making volley use SPDY!

jkyuusai
Jun 26, 2008

homegrown man milk
Asked jet brains guys about android studio features. They said they're currently in a preview version of the full version of Intellij with the official release coming in December.

jkyuusai
Jun 26, 2008

homegrown man milk

more like dICK posted:

So is Android in Intellij just going to be broken until December? http://youtrack.jetbrains.com/issue/IDEA-107311

Based on my reading, this break occurs because of some rearranging of the build tools location in the Android SDK (Xavier Ducrochet explained in the New Android Build System panel on Friday that this was meant to decouple build tool version from SDK version) and Intellij does not seem to be aware of this change. There's a hacky fix linked in the issue involving symlinks. Surprised they haven't patched it yet. Maybe all the devs were at I/O, heh.

I apologize for my short, out of context posts over the last few days. Been posting from my phone (still am) as I run across things but I realize I was falling for the "Get it out quick, details be damned!" lovely tech journalist mentality. I will strive to do better in the future.

Efb;
E: Also in that panel, Xavier gave his official proclamation that all new apps from here on out should be built with the new Gradle based tools. The official line currently is that Ant is going to be deprecated at some point so it's best to get off it as soon as you can.

E2: Last tidbit and then I'll shut up for awhile The "what the hell is Android going to do about new Java features since Oracle hates you" question came up during the keynote, the Android team fireside chat, and maybe the build panel. Every single time the question was soundly dodged. At the fireside chat they simply said "we're working on it" and refused to comment further.

jkyuusai fucked around with this message at 18:58 on May 18, 2013

jkyuusai
Jun 26, 2008

homegrown man milk

Doctor w-rw-rw- posted:

Hey now, I didn't phrase it nearly so harshly at the keynote. >:/ though I agree, it was totally dodged. Sad. I hope that the questions get them to think harder about the problem, at least. That was my intention, anyway.

Out of the variations I heard, yours was certainly the politest. :)

Also, we should totally have done an I/O meet up!

jkyuusai
Jun 26, 2008

homegrown man milk

Hot Yellow KoolAid posted:

I'm having an impossible time deducing the cause of a missing R.java file. I assume it disappeared during cleaning and Eclipse was unable to regenerate it during build. I am using the android ADT version of eclipse, and the minimum SDK of 11.

I suspect that the culprit is some kind of snafu in an XML file, but so far I have been unable to locate anything. The only errors in my entire project (that I can find) are limited to .Java files. I tried an experiment where I made another blank android application and coppied over its original "activity_main.xml" with the one from my project, and it broke it as well.

Have you updated the Android SDK or Eclipse recently by any chance?
If so, can you compile and run a sample project just to make sure all your global settings/SDK/tools are working correctly?

e: Yeah, so after updating MY Android SDK (including the new build tools chunk, plus an additional point revision to the SDK) and ADT, Eclipse claims to not see anything inside my android-sdk folder. Un/Re installed ADT to no avail. gently caress. Here I come IntelliJ!

e2: Annnnd after un/re-installing everything at least twice, closing my left eye and hopping around, it finally started seeing the SDK again. Ugh. Actually, it was all down to missing a trailing slash at the end of the directory, which doesn't get inserted if you set it via Windows Explorer. Jesus.

jkyuusai fucked around with this message at 18:17 on May 29, 2013

jkyuusai
Jun 26, 2008

homegrown man milk

Karthe posted:

Is it possible to use a single certificate on both machines to sign debug builds so that I don't have to always uninstall/reinstall my app when the certs don't match?

Yep!

efb;

Adbot
ADBOT LOVES YOU

jkyuusai
Jun 26, 2008

homegrown man milk

Karthe posted:

What about passing some kind of String or Int key in the second activity's launch intent that you then use in the second activity to requery for the detailed information? That's what I do in my dictionary app - when you find the desired entry from a list of possible matches, you tap it, a second activity opens up, and the second activity grabs all of the detailed info for that entry based on the entry's six-digit identifier.

Yeah, this is what we do basically. We store the data in a sqlite database and when transitioning from a summary to detail view, all we pass is a UUID for the thing we want to show the details of.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply