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
Glimm
Jul 27, 2005

Time is only gonna pass you by

What is Android?
Google’s quirky, beautiful, mobile operating system.

Initial Setup
  1. Development Environments
    1. Android Studio - the blessed future of Android tooling. Gradle support baked in directly. Great live previews of views. Based on IntelliJ IDEA 13 CE
    2. Eclipse - Android is moving towards the Gradle build system and better tooling which is why it is listed first, but you could muck around with Eclipse (though Gradle support for it is nowhere near as far along as Android studio), and you can get Eclipse this way:
  2. Interested in creating low level native applications? Check out the Android NDK.

Learning Android
  1. Forums member jkyuusai posts: Things I found useful while beginning Android
  2. Android Design - Know and use Android design patterns. Don’t be a schmuck.
  3. Android Training - Generally Android applications are created with Java and heavily rely on the Android framework which can take some time to learn. Google’s Android Training sessions are meant to catch seasoned Java developers up to speed and familiarize them with Android to get developers up to speed. Don’t miss any course listed under Basic Training, and really most of the Advanced Courses should be pretty well understood.
  4. Vogella’s Android Development Tutorial - Lars Vogel is pretty well known in the Eclipse community and his series of Android tutorials have helped me from time to time
  5. Professional Android 4 - The author of this, Reto Meier, is an Android DevRel for Google and this is a fairly comprehensive book on the Android APIs and essential developer knowledge.
  6. If you’re interested in developing for Google TV there is Google TV specific development information available. Keep in mind TV is very different:

    Doctor w-rw-rw- posted:

    And while you might think you can just port your tablet layout to GoogleTV, remember that TVs don't have touchscreens, have up to 10% overscan on the edges, are navigated with the D-pad and not usually the mouse, and the option button is practically taboo.


Distributing Applications
  1. Google Play - this is Android's major store. Allows staged rollouts and alpha/beta testing directly through the Google Play app on your end users device.
  2. Amazon AppStore for Android - distribute here to make sure your apps can be installed on Kindle Fires and the like.
  3. F-Droid - FOSS app store
  4. Or just email the apk directly to your users, no provisioning necessary.


Android development/design blogs
  • Styling Android - Posts fairly frequently on different Android related topics, such as using vector drawables to help scale between different UIs and using Android components like the LruCache to create memory caches. (G+)
  • Cyrl Mottier’s Android Development Blog - I mostly linked this because of the series of posts on ‘The making of Prixing’, this implementation of the sliding app menu (popularized by apps like Dolphin HD & Facebook) is pretty great.
  • Holo Everywhere - this blog highlights/reviews Android apps and critiques their design. A good place for inspiration or direction on user expectation. (G+)
  • AndroidDev Weekly - posts a couple of articles on Android development each week which vary in quality.
  • CommonsWare Blog - wrote a book The Busy Coder's Guide to Android Development, posts an answer within 3s to any Android related question on StackOverflow.
  • My Life With Android :-) - writes a few articles a month on various Android topics.
  • Codependent - Chet Haase's blog. Chet is an Android framework engineer who is mostly responsible for making the animation libraries on Android no longer suck.
  • Chris Bane's blog - Chris is an engineer on the Android developer relations team. He created the popular Android-PullToRefresh library.

Useful(?) Tools, libraries, apps, and links
Note: use Gradle, please to find the correct invocation to bring most of the libraries into your project using Gradle
  • Web Requests
  • Analytics
    • ACRA - a library enabling Android Application to automatically post their crash reports to a GoogleDoc form. Much more detailed information than Google Play gives you upon crashes.
    • Crashlytics - very nice crash reporting tool. Great iOS support too.
    • Google Analytics - kind of nice having app tracking sitting right next to web tracking tools
    • Flurry - Pretty popular. My shop has moved away from this tool but it's still widely used I think.
  • Design Tools - creating assets for every major bucket is a pain, these can help
  • Android Support Library - this is basically part of the SDK, but I mention it here because nearly every app will want to use something from the support library.
    • Gone are the days of ActionBarSherlock, if you're one of the unfortunate souls still supporting 2.x pull in the appcompat ActionBar from here.
    • Need a NavigationDrawer? The support library provides an idiomatic NavigationDrawer with instructions.
  • Otto - A publish subscribe mechanism for Android. If you use this and IntelliJ I highly recommend the Otto IntelliJ plugin which will show you which parts of your application are publishing and subscribing to particular events.
  • Dagger - Dependency injection with Guice/RoboJuice on Android is tremendously slow. Square made Dagger to be much faster (a lot of things are done at compile time, made possible by the explicitness of the object graph). Check out Jesse Wilson's InfoQ presentation on Dagger.
  • Android SDK Reference Search - a Chrome extension to add ‘ad’ command to the Chrome omnibox which allows for searching Android Documentation, with autocomplete functionality.
  • Timber - Jake Wharton's excellent logging library.
  • Nine Old Androids - Backports the Android 3.0 animation framework to Android 1.0.
  • Drag-Sort-ListView - Pretty neat looking implementation of draggable ListView items
  • Crouton - A library based on Cyril Mottier's Activity tied notifications. Basically a better looking, more sensible, Toasts replacement.
  • Android Priority Jobqueue - Async tasks are kind of a pain. Jobs are a bit nicer to deal with, especially when used in conjunction with a pub/sub mechanism (Otto/Green Robot), or maybe RxJava
  • DevDrawer - excellent app for organizing your projects on your Android device. Create a widget that lists all of your applications (based on filtering package names), quickly delete apps or clear their data, have them available on your homescreen between installs without having to drag them from the app drawer.

If you're wanting to play around with different libraries and controls check out the DevAppsDirect application. It provides a nice interface for downloading and running samples of many popular libraries.

Open Source Projects Worth Checking Out
  • Awful for Android - developed by Ferg/Geekner/other contributors (thread here), a good example of an ActionBarSherlock application with tablet functionality.
  • Markers - Pretty great drawing application with some neat customizations.

FAQ

I need more help. The documentation is poo poo and Android is whack. Can’t I just talk to the Android team directly so they can fix my broken code?
Sure! Add Android Developers to your circles on Google+. They typically hold developer office hours via Hangout on Wednesdays at 2pm Pacific (UTC-7). It’s pretty awesome, it’s not improbable to get your question about doing something crazy in ListView answered by Romain Guy in one of these. The Google TV team does this as well, but at 1pm Pacific.

I love the animation used in the ICS launcher but I’m not sure how to reproduce it, how can I do that without hassling someone else?
One of the great things about Android is that the OS is open source. If you fancy using something you see in the OS in your own application but it isn’t available directly through the Android API check out the AOSP directly and modify the code to your needs.

I prefer brainfuck and MUMPS to Java, isn’t there another language I can use for Android applications?
I think so! Besides using the NDK (which probably isn’t a good idea to use unless you’re writing a game or something) some developers have been using Scala with success. I’m not one of them but perhaps someone with Scala+Android experience will be kind enough to post a trip report in this thread.

How do I add in-app purchases to my app?
Check out the developer docs on In-App Billing.

Android is terrible, my app crashes whenever I change orientation - why!?
Go back to Android Basic Training, specifically Managing The Activity Lifecycle - Recreating An Activity.

The Android Documentation posted:

Caution: Your activity will be destroyed and recreated each time the user rotates the screen. When the screen changes orientation, the system destroys and recreates the foreground activity because the screen configuration has changed and your activity might need to load alternative resources (such as the layout).

How do I Gradle?
• Forums member Uncomfortable Gaze gives a brief rundown on converting to Gradle

What versions of Android should I support?
• Good question. If your app is already out there you should be able to check your install breakdown via the Play Store Developer Console. Use that data to decide for yourself. My personal opinion? minSdkVersion=14 is upon us. Users who are still on 2.x probably aren't going to download and use apps anyway. Check the monthly OS version breakdown on the Android Developer Dashboard page.



(Suggestions on updating/modifying this OP are welcome!)

Glimm fucked around with this message at 01:37 on Feb 23, 2014

Adbot
ADBOT LOVES YOU

Glimm
Jul 27, 2005

Time is only gonna pass you by

Geekner posted:

Glimm, you should add a link to Awful for Android's source to the OP. It's a good example of a modern Actionbar(sherlock) based app with tablet functionality.

Done.

Also, did anyone notice the developer.android.com redesign? :swoon:

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

Yes. It's horrible. Less readable.

Odd, I find it easy on the eyes. What I really like is the ActionBar styling and the autocomplete in the search box, just looks pretty to me.

Glimm
Jul 27, 2005

Time is only gonna pass you by

If anyone is interested in some swipe to dismiss example code Roman Nurik posted some on Google+ recently:
https://plus.google.com/113735310430199015092/posts/Fgo1p5uWZLu

Which Jake Wharton helpfully backported to utilize his Nine Old Androids (animation library):
https://github.com/JakeWharton/SwipeToDismissNOA

(I've updated the OP to include a link to the Nine Old Androids project)

Glimm
Jul 27, 2005

Time is only gonna pass you by

Thermopyle posted:

New stuff for devs:

On-device app encyrption.
Smart app updates that only send out the part of the apps that have changed.
Google Cloud Messaging which is C2DM on steroids.

To elaborate on this here is Google's dev page on 4.1:
http://developer.android.com/about/versions/jelly-bean.html#google

Glimm
Jul 27, 2005

Time is only gonna pass you by

TheReverend posted:

Hey dudes, I'm coming from an exclusively C# workplace and I'm having some XML issues. In .NET, XML that was formatted like a datatable was pretty easy to sort through, edit columns, add columns, edit rows, delete rows, add rows, etc.

I can't find any nice easy-to-use class within the Android SDK.
Is there anything I'm missing?

I've actually never had to work with xml on Android (the one time I had xml data it was a one-off and I just parsed it into json with a short Python script), so sorry not to have any great advice to give. But this article looks promising, have you checked it out?

http://www.ibm.com/developerworks/opensource/library/x-android/

Glimm
Jul 27, 2005

Time is only gonna pass you by

NoDamage posted:

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.



ActionBarSherlock all the way. It is pretty seamless for the most part.

Glimm
Jul 27, 2005

Time is only gonna pass you by

NoDamage posted:

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.

Android Lint should handle this, check the newAPI section here: http://tools.android.com/tips/lint-checks

As long as you properly set your minSdk/targetSdk you should get warnings when you use newer APIs while supporting older versions, you can then use these warnings to ensure you're guarding against the older versions attempting to use those APIs.

Glimm
Jul 27, 2005

Time is only gonna pass you by

rotaryfun posted:

I've not found an elegant solution for including a populated database with an app. Anyone have any experience or do you always check for a database and create it on a first run?

Does your app have internet access already? Could you download it? Maybe using the APK expansion API?

http://developer.android.com/guide/google/play/expansion-files.html

These are probably terrible ideas, never thought of distributing a database this way. Generally mine are small enough I just create them the first time the app loads.

Glimm
Jul 27, 2005

Time is only gonna pass you by

n0manarmy posted:

I've been working at trying to do some small inconsequential games over the past year and I keep hitting road blocks in my planning and development. Are there any guides on there for approach what is normally Java only development to accommodate android development?

An example of one of the many small issues I'm running into:

I'll create a java object and in the constructor for the object I would set a string value for a string data type, however Android wants to use the strings.xml for all the storage of string data. So do I just initialize the string value to null and then figure out how to access the strings.xml file for the data type or am I completely off base?

If I could find some information or guides out there that hand hold for java to java/android that would probably clear up a lot of my frustration.

I'm not sure what you mean here. The lint tool will complain if you don't use strings.xml, but it's still possible to just use a String programmatically. What issues are you having accessing strings from your resources? It should be something like this:

http://developer.android.com/guide/topics/resources/string-resource.html
code:
strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string
        name="string_name"
        >text_string</string>
</resources>


MyClass.java:

MyClass(Context myContext) {
    String string = myContext().getString(R.string.string_name);
}

Glimm
Jul 27, 2005

Time is only gonna pass you by

Thermopyle posted:

Android development isn't wonderful by any means,

I think it's fun :(

Thermopyle posted:

but I don't think it has anything to do with the activity level in this thread. I mean, it's apparent that Android development is wide-spread, I think its just that there's better resources for getting help a lot of the time.

This is my feeling as well. I think the thread is serving its purpose if it is pointing those interested in Android development at decent resources to help solve their problems. I should probably update the OP more often as it seems like useful Android libraries are popping up every week.

Doctor w-rw-rw- your post of horrors gives me a sad. Supporting older OS versions is probably the most frustrating part of Android development.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Thermopyle posted:

That would be something I'd like to see more posts about. I always miss out on new libraries until they've been out for 2 years or something.

One of the reasons I haven't been posting new libs myself is I haven't had time to really use any of them. In my day job I'm working on iOS and lately I've been too lazy to work on anything in my spare time. But I'll post some things I've seen recently that look neat to me!

Most of these I've found from the #AndroidDev Weekly mailing list, so if you'd rather read about this things directly feel free to subscribe.

Libraries:

The Ultimate Android Library - These guys basically created a site to do what I'm doing here, list a bunch of Android libraries. They put out an example app as well to show them in action. You know it's good because it has the word 'Ultimate' right in the title.

Android Bootstrap - "A template/bootstrap/boilerplate application that includes tons of great open source tools and frameworks" (GitHub link)

Crouton - Cyril Mottier wrote a blog post about his idea of a replacement to Android Toast's and this guy provided an implementation of it. Looks pretty cool, basically context sensitive notifications that are tied to a particular window.

SpongyCastle - Android's Bouncy Castle (security library) isn't quite complete, this lib fills in the missing gaps.

OAK - "OAK is a powerful kit of tools and components to use in your Android project (Compatible with API Level 8+)" (image caching, pinned header list view, section adapter, auto-resizing textview,, encrypted shared prefs, some other stuff).

Undergarment - Slide out menu navigation library. Pretty straight forward, seems to work well.


Tools:

Android Holo Colors Generator - "The Android Holo Colors Generator allows you to easily create Android components such as editext or spinner with your own colours for your Android application. It will generate all necessary nine patch assets plus associated XML drawables and styles which you can copy straight into your project."

j2ObjC - translate Java to Objective-C. Google uses this tool to write their poo poo in Java and then translate to Javascript (with GWT) so they can write some code once in Java for the web, Android, and iOS! Pretty snazzy. Though there are some pretty obvious limitations (specified on the project page).

android-unused-resources - clean up unused resources in an Android project. Hallelujah.

Glimm fucked around with this message at 02:44 on Sep 29, 2012

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

Android-unused-resources is great. However, and without trying to paint the strokes too broadly, I'm going to go out on a limb and say most of us don't use most of these extra libraries if we do Android for a living. Have you tried building an app with lots of libraries? Here's what can happen:

Yeah this is definitely something to weigh while creating an app. It's pretty easy to have an empty shell of an app with an apk around 7-10MB.

quote:

* Android tools update. You decide to update. Guess what? they changed the directory libraries go in without telling you. It's now libs/ instead of lib/.

This was annoying as hell.

Geekner posted:

Definitely going to give this one a try, been looking for a decent image caching solution.

I haven't personally used OAK yet so I'm not sure how it handles, but I've used AQuery in the past and it's fantastic. I'd probably try that first unless you're interested in other features OAK provides as well.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Geekner posted:

I recently did a fresh install of the SDK on a new system, and I gotta say the hardware-accelerated Intel emulator is really loving sweet. I'm able to run Awful with gifs playing at full speed. No extra effort unless you run native code (then you have to add the intel build target).

Just make sure to actually run the HAX installer in the extras folder.

I don't think the actual atom-based devices will catch on very well, but at least Intel put some serious effort into their emulator module.

Yeah it's pretty awesome. Before an official x86 emulator was around I'd sometimes use the Google TV emulator just to mess with something where the speed wasn't abominable.

In Android news for the day Android's new build system has been officially announced and is at version 0.1, yay!

https://plus.google.com/109385828142935151413/posts/XnW7t9XJCMJ
http://tools.android.com/tech-docs/new-build-system

Xav posted:


I'm happy to announce that the first milestone of our new Android SDK build system is now available to try.

Warning/Disclaimer: this is a (very) early access and is not meant to replace the existing one to ship applications.

We are looking for feedback on the build system and its features.

Current limitations of milestone1 (version 0.1):
  • No support for Renderscript
  • No support of NDK
  • No support for Proguard
  • No Lint integration
  • No emma support
  • JUnit output is only in the console
  • Location of source folders isn't corrently customizable.
  • Binary packaging of library is still going through changes. Do not upload libraries to maven central (or other similar repos) just yet.

Glimm fucked around with this message at 00:02 on Oct 4, 2012

Glimm
Jul 27, 2005

Time is only gonna pass you by

Interesting post Ferg linked to on Google+:

Reverse Engineering Android: Disassembling Hello World

quote:

When it comes to learning Android, it’s amazing how easy it is to find tutorials, code samples, and documentation to immerse yourself into the world of Android. Interestingly, I’ve found the inverse to be true for the, dare I say, way cooler world of hacking Android. Reverse engineering Android applications can be really fun, and give you a decent knowledge for the inner workings of the Dalvik Virtual Machine. This post will be an all-out, start-to-finish, beginners* tutorial on the tools and practices of reverse engineering Android, through the disassembly and code injection of the Android Hello World application.

Glimm
Jul 27, 2005

Time is only gonna pass you by

This is pretty cool:

http://www.androidviews.net/

Lots of different helpful views/libraries to use in your own projects.

Glimm
Jul 27, 2005

Time is only gonna pass you by


I lazily linked to this post from the OP and added Drag-Sort-ListView to the list of useful libraries.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

Neat, thanks. Mind adding the link to SlidingMenu? It's mentioned in the same line as DSLV but not as its own bullet.

Oh oops, I thought I had added that awhile ago!

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

It's career ending if Android was supposed to be a 1-or-2 month side project that you really didn't want to do in the first place, but did because you were the most qualified at a small company you liked -- then ended up doing for two years, neglecting your other skills and passions, hating yourself the whole time. My situation isn't common I'm sure. It's gotten to the point where I've stopped caring about my work and about programming, even though I've been doing it for 80%+ of my life - and I'm not even 25 yet.

Agreed on the other parts though.

That really sucks :( I find myself in a bit of the opposite situation (I mostly work on iOS), though I don't have such an extreme distaste to iOS development as you have built up to Android. I wish I had more time on the side to work on Android stuff, c'est la vie.

In other news, this looks like a handy project:
https://github.com/cesarramirez/ADG-Android_Drawable_Generator

quote:

This is a tool that allows for the automatic creation of drawables resources for the different screen densities in an Android projects.

Uses perl and Imagemagick to do its work. Looks neat.

Glimm
Jul 27, 2005

Time is only gonna pass you by

IntelliJ for personal use is on sale right now, $50 (normally $200):
http://www.jetbrains.com/specials/index.jsp

I also picked up PyCharm ($25) though I typically use Vim for Python stuff, as I buggered my autocomplete settings for Python last weekend and can't be arsed to fix it; I've never used PyCharm - hope it doesn't suck. IntelliJ however I think is pretty awesome and if you hate Eclipse maybe give it a shot (there is a free Community Edition as well).

Glimm
Jul 27, 2005

Time is only gonna pass you by

ultramiraculous posted:

You might want to ask for a refund on PyCharm if you bought IntelliJ. All of the features of PyCharm are actually in the Python plugin that comes with IntelliJ Ultimate.

Oh dear, thanks for the heads up!

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

it'll save you from writing Java code.

This sounds worth it.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

  • Fragments let you save and restore their state from bundles. I'm hazy on this since I haven't touched android in a couple of months.
I think you want to use onSaveInstanceState, then you can rely on that Bundle in onActivityCreated to setup the Fragment state.

quote:

  • Don't nest fragments.

Actually, this should be okay now:
http://developer.android.com/about/versions/android-4.2.html#NestedFragments

As far as I know nested Fragment support works in the support library as well.

It looks like the person who made this StackOverflow post was having a similar issue and solved it:
http://stackoverflow.com/questions/7707032/illegalstateexception-when-replacing-a-fragment

Glimm fucked around with this message at 03:29 on Mar 9, 2013

Glimm
Jul 27, 2005

Time is only gonna pass you by

Karthe posted:

What's the best way to close a foreground activity and pass info back to the parent activity after rotating the screen? My app displays two columns in landscape mode and one column in portrait mode. When the device is in portrait mode, tapping on a listView item in Activity A starts up Activity B and displays additional information about that entry.

Maybe use one Activity with a landscape orientation containing two Fragment containers and a portrait orientation with only one, and just maintain state within the single Activity?

Glimm
Jul 27, 2005

Time is only gonna pass you by

Karthe posted:

I tried using FragmentTransaction's earlier to do the whole two-column-landscape/one-column-portrait but it got real messy, or at least was beyond my ability.

Here's a video of the strange activity I'm seeing with my current code:
https://www.youtube.com/watch?v=yhKeoNMPV-8

Maybe check out the Master Detail View sample that comes with the SDK? Create a new project within Eclipse (target SDK 11+) and select the Master Detail View template and try to match what you're doing with the sample.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Has ActiveAndroid come up before? Can I gush over this library for a bit?

https://github.com/pardom/ActiveAndroid

ActiveAndroid posted:

ActiveAndroid is an active record style ORM (object relational mapper). What does that mean exactly? Well, ActiveAndroid allows you to save and retrieve SQLite database records without ever writing a single SQL statement. Each database record is wrapped neatly into a class with methods like save() and delete().

ActiveAndroid does so much more than this though. Accessing the database is a hassle, to say the least, in Android. ActiveAndroid takes care of all the setup and messy stuff, and all with just a few simple steps of configuration.

Examples pulled from the GitHub page:

Create some model classes

code:
@Table(name = "Categories")
public class Category extends Model { 
	@Column(name = "Name")
	public String name;
}

@Table(name = "Items")
public class Item extends Model {
	@Column(name = "Name")
	public String name;
 
	@Column(name = "Category")
	public Category category;
}
Query the db
code:
public static List<Item> getAll(Context context, Category category) {
	return new Select()
		.from(Item.class)
		.where("Category = ?", category.getId())
		.orderBy("Name ASC")
		.execute();
}
It also has a ContentProvider built in!
https://github.com/pardom/ActiveAndroid/blob/master/src/com/activeandroid/content/ContentProvider.java

Haven't used it much, just set it up today for a new project. But so far, so good.

Glimm fucked around with this message at 14:59 on Mar 23, 2013

Glimm
Jul 27, 2005

Time is only gonna pass you by

Anyone else looking for a mobile focused dev conference to goto? I didn't win the I/O lottery so I've been looking at a few options.

AnDevCon Boston (28-31st May) looks fairly promising, kind of pricey at $1395 a ticket.

Droidcon London (24-27th October 2013) seems awesome. Much cheaper (£100 ~ $152 USD). The ticket+flight will actually be cheaper for me if I go this route, and hey - it's in London!

I'm not really sure what to expect out of training sessions/classes/talks as I haven't been to either conference or any major dev conference. Anyone checked these out before?

Glimm
Jul 27, 2005

Time is only gonna pass you by

Murodese posted:

I bought a copy a few years ago when I started doing Android dev, and it worked pretty well. Had a few minor bugs here and there (which I'm sure they've fixed long since).

Are we talking about the same library?

https://github.com/pardom/ActiveAndroid

This is released under the Apache license and appears to have only been under development for 4 months or so.

Glimm
Jul 27, 2005

Time is only gonna pass you by

GenJoe posted:

Is there a way to programatically disable the android WebView from loading the mobile version of a website? It seems that the WebView defaults to loading mobile versions, but for my purposes I pretty much need it to load the default version of the website.

Maybe try using WebSettings:

http://developer.android.com/reference/android/webkit/WebSettings.html#setUserAgentString%28java.lang.String%29

code:
webView.getSettings().setUserAgentString("Some user agent that represents itself as a desktop?")

Glimm
Jul 27, 2005

Time is only gonna pass you by

Small White Dragon posted:

Is it possible to scale a view in Android? If so, how?

For those of you familiar with iOS, I'm asking about something similiar to self.layer.transform = [3d matrix], although just a 2D transform will be sufficient.

I googled around, and a few people asked this question only to get "Did you try just setting the width/height?" which is NOT what I'm looking for.

That is strange advice, Android Views don't have width/height directly - those are calculated based on top/bottom/left/right. You could animate those values though.

Could you use a ScaleAnimation?

http://developer.android.com/reference/android/view/animation/ScaleAnimation.html

Something like:
code:
ScaleAnimation a = new ScaleAnimation(fromXscale, toXscale, fromYscale, toYscale);
myView.startAnimation(a);

Glimm
Jul 27, 2005

Time is only gonna pass you by

Sab669 posted:

Hey guys, I'm looking for a particular app that doesn't quite seem to exist so I thought I'd try to make it myself. I've got a good bit of C# experience but very very little with Java and mobile development.

All I want it to do is this:

pre:
-Press button
  -Start recording a video
  -Maybe actually display the video as it records
-Pres button
  -Stop recording video
  -Upload video file to an FTP, or possibly just email it as an attachment
  -Delete the local video
It would be for personal use only so it doesn't need to be flexible (ie. change FTP / email) or pretty. How difficult would something like this be? It sounds pretty darn simple.

That sounds really simple to me.

You might look into using Xamarin Studio (http://xamarin.com/studio) and just writing the app in C# if that's what you're familiar with. I haven't used it but from what I understand you don't need a license to create small applications (I don't know what the cutoff is exactly but it sounds like you would not come close to it).

Glimm
Jul 27, 2005

Time is only gonna pass you by

Sab669 posted:

I've considered using Xamarin but figured I should probably brush up on my Java skills because I need a new loving job. I don't think Xamarin really makes it any easier to develop ultimately. And with the free license you can build apps and test them on a virtual device but you can't actually publish them I believe. I briefly used it to emulate a barcode reader for work but never got far with it :v:

The old Xamarin suite (MonoTouch?) worked that way, but the new one (Xamarin Studio) does allow you to work on actual hardware (this I've seen) and from what I understand you can even publish apps under a certain size (32k of IL code according to http://xamarin.com/monoforandroid - doesn't sound like much but I think it would fit your use case).

Doing it in Java isn't a bad idea, I just suggested Xamarin given your C# background. I don't think it would take too long to do what you're trying, if you get hung up feel free to post some code and ask for advice.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Karthe posted:

Does the Play Store not check an app's minimum SDK level and auto-exempt devices that are running an earlier version of Android?

It does. This is generally a good way of excluding older devices. I generally target 2.3+ now, and am really considering moving to 4.0+.

You could check over the filters documentation for filtering on other things which might help:
http://developer.android.com/google/play/filters.html

Glimm
Jul 27, 2005

Time is only gonna pass you by

edit: I'm an idiot

Glimm fucked around with this message at 00:21 on Apr 24, 2013

Glimm
Jul 27, 2005

Time is only gonna pass you by

Salvador Dalvik posted:

Huh? I saw the response before you deleted it, it was perfectly normal?

I really look forward to the day we can completely forget about 2.x.

After I wrote it I re-read the posts and figured you were asking j4on directly. My spergtastic nature required removal of my post.

I'm excited to leave 2.x behind. Thankfully for most of our apps installs on 2.x are down to about 35%. Yay for progress!

I always feel bad for the Android folks (I mostly do iOS dev at work) when I get to bump up my minimum SDK for cool feature X (ARC and weak references hallelujah) and they have to just deal with it. Like you said though backwards compatibility isn't terribly difficult to maintain in Android, still a bit of a pain though.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Somewhat cringe inducing but otherwise informative video from Google on the in-app purchase API:

https://www.youtube.com/watch?v=rnsgAvFUEUo

Glimm
Jul 27, 2005

Time is only gonna pass you by

Karthe posted:

What component does the Play app use to allow for left-to-right swiping between categories? I want to implement something similar but I'm not sure what I should be looking for. I thought it was a spinner, but I found out that's just Android's drop-down list. Is it an alternate form of the action bar's navigation tabs?

You're looking for the ViewPager, which is in the support library:
http://developer.android.com/reference/android/support/v4/view/ViewPager.html

The new Play store uses its own implementations of some things the ViewPager gives by default, you can read about it here:
https://plus.google.com/108761828584265913206/posts/Cwk7joBV3AC

Looks like someone made an implementation based on the above post already that should be pretty much drop in:
https://github.com/astuetz/PagerSlidingTabStrip

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

I think ViewPagerIndicator also has the same control. If so then use that library, as the same guy behind ActionBarSherlock is behind VPI, so you're assured some level of quality.

It's similar, but somewhat different from the new implementation in the Play Store.

Just to add a link VPI is available here:
https://github.com/JakeWharton/Android-ViewPagerIndicator

(If you're interested in the differences they're explained pretty well in Kirill's post: https://plus.google.com/108761828584265913206/posts/Cwk7joBV3AC)

Glimm
Jul 27, 2005

Time is only gonna pass you by

it is posted:

I have a spinner with this XML
code:
        <Spinner
            android:id="@+id/spinner1"
            android:entries="@array/electronics"
            android:prompt="@string/select_device"
            android:layout_width="216dp"
            android:layout_height="wrap_content" />
how do I turn that into Java?

I tried this and it didn't work; the spinner is completely blank:
code:
		electronics = new Spinner(context);
		electronics.setId(ELECTRONICS_ID);
		electronics.setPrompt(context.getString(R.string.select_device));
		ArrayAdapter<String> electronicsAdapter = new ArrayAdapter<String>(context, R.layout. R.array.electronics);
		electronicsAdapter.setDropDownViewResource(ELECTRONICS_ID);
		electronics.setAdapter(electronicsAdapter);
		LayoutParams electronicsLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

You probably want to reference the Spinner you created in xml, something like:

code:
		electronics = (Spinner) findViewById(R.id.spinner1);
Check this page out for more info on using Spinners:
http://developer.android.com/guide/topics/ui/controls/spinner.html

Adbot
ADBOT LOVES YOU

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

Holy loving poo poo.

Volley.

Every single pitfall that the presenter pointed was something I encountered in making network requests. Every single solution and diagram was something I had drawn up as a solution but was never given time to implement properly.every feature addressed a deficiency I needed.

And it's backwards-compatible to older versions of android. Wow. Great!

Yeah Volley looks extremely useful. I'm excited to use it!

Now I don't know what to look at first, OkHttp/Picasso (http://corner.squareup.com/2013/05/picasso-one-dot-oh.html) or Volley?

Probably Volley.

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