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
NoDamage
Dec 2, 2000
Just curious, how are you guys dealing with this? 90% of devices are still below 3.0.

Are we stuck using ActionBarSherlock and the compatibility library? It seems like I might as well pretend that Honeycomb/Ice Cream Sandwich/Jelly Bean don't even exist, if I'm pretty much forced to code against 2.3 anyway.

Only registered members can see post attachments!

Adbot
ADBOT LOVES YOU

NoDamage
Dec 2, 2000

Glimm posted:

ActionBarSherlock all the way. It is pretty seamless for the most part.
Since ActionBarSherlock requires me to compile against Android 4.0 but I want to target 2.3, is there a way to have Eclipse tell me if I've accidentally used an API not available in 2.3? I seem to remember reading this was possible but can't find the source again.

NoDamage
Dec 2, 2000

ADINSX posted:

We have an application that has a bunch of different activities reachable by a main menu. Pretty standard stuff.

Our customer likes that for phones, but for the tablet version they want all of these unrelated activities jammed into the same page (yes I know this is dumb, its not up to me). I've been reading about fragments but this doesn't seem to be the typical use case for them... What I want is something like a group of iframes on a webpage, with all of the activities in a single group running together with no knowledge of each other. Whats the best way to accomplish this?
Er, this sounds like exactly the use case for fragments.

NoDamage
Dec 2, 2000

Gangsta Lean posted:

Does anyone do Android development in VirtualBox? Is it supposed to work?
The Android emulator is super slow as is, I can't even imagine how much slower it will run inside a virtual machine. What you can try instead is installing Android-x86 in another VirtualBox and running Android directly on that, rather than using the emulator inside a VirtualBox. (I do this anyway because it's so much faster than running the emulator natively.)

NoDamage
Dec 2, 2000

Doctor w-rw-rw- posted:

You realize there's official x86 emulation now, right?
Well now I just feel stupid. Hah.

On another note, after much debugging with Eclipse Memory Analyzer I have learned a painful lesson: never declare a WebView in XML, always create it programmatically, and never set its context to an Activity (use your application context instead). Failure to do so will lead to horrible memory leaks 100% of the time.

NoDamage
Dec 2, 2000
Does anyone have experience submitting an Android app to the Amazon App Store (in particular, for the Kindle Fire)? We've gotten approval on the Amazon App Store in general, but our app isn't listed as compatible with the Kindle Fire (even though it is technically compatible).

Apparently there's a separate approval process to get onto the Kindle Fire store, but Amazon is being incredibly vague about it.

Since the Kindle Fire was the main reason for us developing an Android version in the first place, this is kind of annoying.

NoDamage
Dec 2, 2000

Karthe posted:

I'm simply trying to design an app that gracefully switches between a one-column layout and a two-column layout depending on orientation of the device. The reason I'm going for something this fancy is because a two-column layout in portrait mode on a Nexus 7 (the only physical device I have to test on) suffers from columns that are a bit too small to appreciably display listView items. Based on all the trouble I've had thus far, though, I think I'll abandon this for now and just make a two-column layout for sw600dp+ tablets, and use a one-column for everything smaller than that.
You should almost certainly use fragments for this. I've done the exact same thing for the Nexus 7 (2 columns in landscape, 1 column in portrait), it's not too hard if you're using fragments for each column. Use layout aliases to specify which layout to use depending on the width of your screen.

NoDamage
Dec 2, 2000
So now that there's an ActionBar in the support library is there any reason to use ActionBarSherlock?

NoDamage
Dec 2, 2000
So onRetainNonConfigurationInstance() is deprecated, which I was using to store my AsyncTasks when my Activities are re-created during rotation. The suggested solution is to store it in Fragment with setRetainInstance(true), which seems a bit bizarre to me. Is this really the recommended method for saving AsyncTasks between configuration changes? Shove it in an interface-less Fragment?

NoDamage
Dec 2, 2000
Do recent versions of Android have a browser extension capability similar to iOS 8's Safari extensions? I'd love to be able to run some JS in the browser and extract the resulting HTML.

NoDamage
Dec 2, 2000

speng31b posted:

I have no idea what iOS 8's Safari extensions do, but in newish versions of Android you can enable debugging on webviews and inspect them over USB debugging with chrome://inspect to debug stuff with the chrome developer tools.

Or maybe you're looking for something like https://developer.chrome.com/multidevice/android/customtabs ?
To clarify, this would be for a user feature similar to a bookmarklet, not for development/debugging purposes. A Safari extension allows an app to run Javascript code against the currently loaded Safari page, and then return the result to the app itself. Think something like Evernote/Instapaper, where the user might want to clip the contents of the current page and save it into another app.

NoDamage fucked around with this message at 09:13 on Feb 4, 2016

NoDamage
Dec 2, 2000

Tunga posted:

I think the way to do this would be to have your app accept URL/text shares and then the user can share the URL from their browser to your app which will load/parse/process the data in whatever ways it wants to.
Yeah that's what I'm currently doing, the problem is you only get the URL so you have to reload the page in a WebView if you want to run JS on it, and then if the page is behind a paywall and the user isn't authenticated, or if the page's contents are loaded via AJAX, you might not end up loading what the user originally saw in their browser. Sounds like setting up a bookmarklet might be the best option for me, but it's not as seamless as appearing in the Share menu.

NoDamage
Dec 2, 2000
Can someone confirm whether the NDK documentation is indeed completely out of date when it comes to building C++ code with the latest Android Studio? From my preliminary research it looks like what they describe (editing the Android.mk and Application.mk files to specify build settings) has been entirely replaced with options in build.gradle.

Edit: It looks like NDK support in Android Studio is horrendously incomplete. Argh.

Edit 2: Finally got everything to work (Java calling into C++ code that uses the standard library and links against a pre-built static library). What should have taken a few minutes with the proper documentation ended up taking an entire day to sort out. Had to upgrade to the experimental version of gradle to get support for static library dependencies, and then a lot of trial-and-error guessing at the new gradle syntax to get the compiler flags and dependencies specified correctly. I would do a writeup of how to get everything running but it's probably pointless cause it will likely change again soon.

NoDamage fucked around with this message at 08:52 on Feb 24, 2016

Adbot
ADBOT LOVES YOU

NoDamage
Dec 2, 2000
I'm building a new version of an Android app I originally wrote back in 2012 and just wanted to check if things have changed a lot since then. (I've been mostly in iOS land lately.) In particular, has anything changed with how modern Android apps load data from a local database, display it on screen, and keep it synced if further changes are made to the database?

My original implementation used a ContentProvider as the wrapper around a SQLite database and then used a CursorLoader/CursorAdapter to fetch the data and populate a ListView. All inserts/updates/deletes went through the ContentProvider API which would call ContentResolver.notifyChange() to ensure the ListView got updated when something changed. But now I'm reading that you shouldn't really bother using ContentProviders if you're not trying to expose data to other apps, just use SQLite directly instead. Okay, so if you fetch a bunch of data from SQLite and shove it in a list view. Lots of tutorials and documentation on how to do that.

But then you have a background service running that syncs that data with a server. New rows get added to the database by the background service. How do you (efficiently) tell your ListView to add the corresponding rows?

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