|
Suran37 posted:I am trying to figure out ActionBarSherlock for an app I am working on. I am currently trying to add a button that opens a new activity, I tried following the Action Provider sample, but I seem to be stuck on the intent. The sample opens the phone settings menu, and I have been struggling to try and modify it to open my activity. My code so far can be seen here: http://pastebin.com/cc4pN6qF Any reason you're using an ActionProvider over a simple menu item? Are you familiar with how ICS actionbar or pre-ICS menus work? 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. zeekner fucked around with this message at 04:52 on Jun 22, 2012 |
# ¿ Jun 22, 2012 04:50 |
|
|
# ¿ Apr 28, 2024 10:01 |
|
NoDamage posted:Just curious, how are you guys dealing with this? 90% of devices are still below 3.0.
|
# ¿ Jun 28, 2012 12:01 |
|
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. ActionbarSherlock is great, but there is a big gotcha you need to watch out for: Whenever you have the Sherlock version of a class available, use it instead of the official android one. This'll bite you if your not careful. For example, you have to use Sherlock's Window.FLAG_XXX instead of the official android one, because their "Activity.addFlag()" function takes a long instead of an int (they couldn't override the method). Don't let that stop you, just watch your import list. Seriously, ActionbarSherlock makes a unified, compatible UI so much easier.
|
# ¿ Jun 28, 2012 19:36 |
|
Karthe posted:I installed the most recent 4.1 SDK from scratch and set up a virtual device with the WXGA800-7in preset to emulate developing on a Nexus 7. Aside from giving the device a name, I left everything as-is. Unfortunately, whenever I start it up, it fails to run and spits out the following message: I have the same issue trying to emulate most XHDPI screens (like the Galaxy Nexus, 1280x720@320ppi). I can't find any info other than I might be exceeding some kind of framebuffer limit. That theory makes sense because I can bypass the problem by setting the resolution lower, but that prevents me from testing layouts for the newest phones. e: I have 8gb of ram, i3-3120, Radeon HD6850 on Win7 x64. I doubt it's computer specs.
|
# ¿ Jul 24, 2012 05:12 |
|
R.java is recreated during compile, but eclipse auto-compiles it as you go, since you need it to reference against to keep autocomplete/intellisense from freaking out. A common cause for it failing to compile is the wrong java compiler compliance level. In eclipse, right click project -> properties, under Java Compiler, check the compliance level, it should be 1.6, with the default settings box under it checked. e: Also, if you tend to use sub-folders for separating out your code (like com.package.appname.subfolder), in those folders you can't indirectly reference the R class, you had to import it (import com.ferg.awfulapp.R;). At least you couldn't a while ago, I don't know if they ever fixed that. zeekner fucked around with this message at 05:18 on Aug 19, 2012 |
# ¿ Aug 19, 2012 05:13 |
|
Glimm posted: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. I especially like this part: Doctor w-rw-rw- posted:But yeah. This is Android for you. Years of bullshit you'll never escape, fixes that stare you in the face and tantalize you with their presence only on high version numbers, and compatibility libraries that bridge some of the gap. Because that sums the whole experience up quite nicely. I'd take Apple's artificial feature segmentation over the very real and disruptive API fragmentation we have now. Doc, I feel ya. WebView is my white whale, just as VideoView is to you.
|
# ¿ Sep 29, 2012 02:33 |
|
Glimm posted: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). Definitely going to give this one a try, been looking for a decent image caching solution. A recommandation for anyone looking to parse HTML, try jSoup, it's pretty nice.
|
# ¿ Sep 29, 2012 02:48 |
|
Glimm posted: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. I already use AQuery for imageviews, but I need something that can provide bitmaps directly. AQuery works great, but it's image code is pretty much focused on ImageViews, so it's hacky to use it for anything else.
|
# ¿ Sep 30, 2012 03:21 |
|
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.
|
# ¿ Oct 2, 2012 05:50 |
|
CapnAndy posted:I decided to get into Android development and I'm already pretty good at c# and visual studio, so I got MonoDroid. At first glance, it's super neat. But I want that frigging title bar to go away! I did this: You have to add window flags and request window features before you call setContentView, since it takes those flags into consideration when it creates the layout.
|
# ¿ Oct 10, 2012 18:55 |
|
I keep running into convenience functions that were added in API 8/9/11. I hate spending time re-implementing poo poo that should have existed in API 1. String.isEmpty() - added in API 9 gently caress. There should not be twice as many phones with 2.1 than 4.1.
|
# ¿ Oct 16, 2012 02:03 |
|
CapnAndy posted:Okay, answer another newbie question? I'm still playing with MonoDroid and I want to learn to draw things. I found about making my own view and overriding its OnDraw event, but that's okay for, y'know, drawing something once and then it never moves again, and also I lose Main.axml which would be a shame. I want to do something really basic, like draw a box and have it change colors or resize every time I click a button or on a Timer tick. You have to call invalidate() to cause the onDraw to refresh again. If you are animating or drawing anything dynamically you should look into a SurfaceView instead, that will let you grab the canvas whenever you want. Murodese posted:Every single time I have to dig into Android to do something weird, I find yet another bug introduced by some idiot loving manufacturer (HTC, you should know better ) who decided to do their own thing and use their own broken loving bluetooth stack / date/time implementation / literally anything, never updates it, never fixes it and makes it impossible to work around. Yup, just ran into something weird with how the newest RAZR handles Cursors in Awful.apk, it's auto-closing them while they are still in use. It's causing constant crashes for one specific phone model. We handle cursors using the newest API and have zero issues with that code on every other phone out there. gently caress that poo poo.
|
# ¿ Oct 22, 2012 17:47 |
|
CapnAndy posted:HA! I guessed that! I made a SurfaceView! Also make sure to look into the surface holder callback interface, it'll let you gracefully handle size changes.
|
# ¿ Oct 22, 2012 19:02 |
|
CapnAndy posted:I don't follow. I lock the canvas so nothing else can touch it, but I still don't have access to the canvas itself, so how can I draw on it? You don't create the canvas directly, you let the OS generate the canvas when you call lockCanvas(). Here's a basic example: code:
You'll want to look at the SurfaceHolder.Callback interface if you want to handle lifecycle changes better (like the surface getting created/destroyed/resized). This is technically optional, but strongly recommended. For now you can just check to see if the canvas you get from lockCanvas() is null before you use it.
|
# ¿ Oct 23, 2012 03:42 |
|
CapnAndy posted:Okay, it's been a bit because I had actual projects to do and those come before learning new stuff, but I'm back to this, and the canvas I get from lockCanvas() is always null. I tried doing this: You're really making this a lot more complicated for yourself by trying to use MonoDroid. If you check the documentation for lockCanvas() you'll see "A null is returned if the surface has not been created or otherwise cannot be edited." Even though you added the child view, it still hasn't actually created the layout for that surface. The actual surface creation is done asynchronously outside the onCreate function, and you'll get a callback if you use the SurfaceHolder.Callback interface to monitor the surface. You're completely skipping XML layouts, which significantly reduce the complexity of creating the surfaceview. In the second half you just override your existing canvas, which makes no sense. The first canvas is null for the reasons listed above. Canvas c = surface.Holder.LockCanvas(); c = new Canvas(); Honestly, I would highly recommend just taking the plunge and using regular Java and look at the huge number of practical examples they give you. The LunarLander example is exactly what you need to learn how to handle a SurfaceView, and digging through the other examples will give you a much better idea about how Android works.
|
# ¿ Nov 1, 2012 20:31 |
|
Hot Yellow KoolAid posted:I took an android class this summer (though I don't have a phone, planning on buying one for christmas) and I don't know how to install the .apk file from a finished project onto an android device. I have read so far that the file can be sent to a device as an attachment to an email, but I'm not sure how to install it/where the file is stored on the device from there. Is there an easy way to install an app from an .apk file? There are plenty of easy ways to do it, but I typically just use ES File Manager. It can connect to a Windows file share or Dropbox, then you just tap the apk file and it'll offer to install it. Alternatively, you can email the file or a link to the file hosted online somewhere. If you download it to the external/SD storage on the phone, you can tap the notification entry for that file to automatically install it. Either way, make sure to enable the "Unknown Sources" in the phone's development options beforehand.
|
# ¿ Nov 19, 2012 07:29 |
|
Giant Goober posted:I downloaded the sdk's and managed to get a few of the samples running last night. I noticed in JetBoy that there is a lot of subclasses in the view and that the members on objects are all public with no getters and setters. Is this standard practice for android development, or it quick implementation of the samples? They try to minimize the size of those examples, to make it easier to figure out. It is pretty normal to use anonymous inner classes for little things like OnClickListeners and such. But yea, just follow whatever Java style guide you feel is best for you, you won't run into any real issues. I shudder every time I see Enterprise™ quality code in an android app. Google put a lot of effort into making Dalvik a simple, straightforward Java.
|
# ¿ Nov 21, 2012 00:55 |
|
Doctor w-rw-rw- posted:I am somewhat guilty of this, having just discovered IntentServices and (Detachable)ResultReceivers as a substitute for using AsyncTasks to make network calls with a callback-like pattern. It's not awesome, but it's sufficient, and still works when specifying the service to run in its own process. That's pretty reasonable for network calls though, we use a message-passing service to do them in Awful (since 2.2) and it simplified the hell out of networking and failure fallbacks.
|
# ¿ Nov 21, 2012 03:48 |
|
Doctor w-rw-rw- posted:HOLY loving poo poo God drat, I wish I knew about this a few weeks ago. This is going in Awful, gonna throw out the split-screen code I just barely added.
|
# ¿ Nov 29, 2012 04:50 |
|
This man speaks truth. I've lost pretty much all the respect I had for Google over the last two years. Even as they slowly catch up, they still fail to fix many fundamental issues and then introduce new issues on top. Then you get into API fragmentation and OEM fuckery
|
# ¿ Dec 4, 2012 08:16 |
|
Ranma posted:This seems suited to the current rants: That looks like you hit every point, but last time I used the Maps API it was with v1 and they didn't require the package name to sign up. I can't tell what's wrong there. e: Can you try to generate a normal signing key, authorize it, and build the final app with it?
|
# ¿ Dec 11, 2012 03:42 |
|
amishpurple posted:Can anyone better explain the purpose of using putExtra() in this section of the tutorial? I just don't understand what it does and subsequently why it's needed. It's explained further down in that example, when they pull the message from the intent. code:
Don't rely on this to send everything; if you have a lot of data that you need to use throughout your app, look into Services or ContentProviders.
|
# ¿ Dec 27, 2012 20:58 |
|
Karthe posted:I tried compiling an older app (it targets API8) today via the command line as per a write-up on the app's Google Code page. Unfortunately, compilation errors out when the build process attempts to call the (I've come to find out) deprecated apkbuilder tool in android-sdk\tools. You can run "android update project" from the command line to update the ant build files for that project. You can also import the project into Eclipse and build it using the export function (right click project -> export -> android). Just make sure they didn't do any weird customization in the build.xml, it'll get replaced when you run the update.
|
# ¿ Jan 6, 2013 08:58 |
|
You should use Log.e/Log.w/ect, it makes that sort of testing really easy and unambiguous. I doubt the TextView has anything to do with the problem, I would look at your DownloadText function. Android is a pretty good clone of Java 6, it's not perfect. Some libraries are missing or don't function the exact same way. Here's a simple GET to String example (using the Apache HTTP and IO libraries): code:
code:
|
# ¿ Jan 30, 2013 17:49 |
|
Pseudo-God posted:If I wanted to program a simple roulette wheel or audio visualizer(just bars), do I have to use OpenGL, or is the canvas view suitable? If it's just 2d and you won't need to animate more than 20fps, you can try a SurfaceView. Look at the LunarLander example code to see how it's implemented (get it here). It'll let you run a secondary thread to animate the view. If you run into performance issues, you can try to swap that for a GLSurfaceView. If you need more performance than that you'll want to look into the NDK+opengl. You could run a custom View and just override onDraw, but that method has a lot of limitations (especially for animation). You'll have to call invalidate() every time you want to refresh. Those invalidate calls are processed on a queue, so it's can get choppy if you're trying to animate motion.
|
# ¿ Feb 18, 2013 03:12 |
|
getView() is null until you return from onCreateView(). The view you create there is the one that getView returns. Use getActivity to get a context.
|
# ¿ Feb 22, 2013 18:19 |
|
Karthe posted:Someone finally explained CursorLoader to me in a way I could understand. I promptly realized that I never "got" them because I'd been trying to cram a square peg into a round hole. Karthe posted:If I set a cursor to close after I finish setting it to a ListView, the app crashes with the following error: It's critical that you remove the cursor from the adapter before you close it.
|
# ¿ Mar 2, 2013 08:24 |
|
Sorry, I should have been more specific. I was saying he should only close it if he was managing the cursor himself (no loaders, ect).
|
# ¿ Mar 4, 2013 05:59 |
|
admiraldennis posted:Is there some kind of updated go-to guide to dealing with assets for Android? Things like resolution, etc. Get to know 9-patch really well. They are a major timesaver, and it's pretty easy to convert existing PNG files to 9patch. Ignore Google's 9patch utility, just use Paint.net or something to resize for one extra pixel border, then save the file with .9.png. Since you are in control of asset creation, you can have the designer target all three major DPI levels (MDPI/HDPI/XDPI). The other DPI levels aren't really worth targeting, MDPI can scale down to LDPI without issue and I don't think the 480dpi level (XXHDPI) will matter for a long time. I haven't even been able to find a XXHDPI phone to see the difference. Honestly, in a pinch you can usually get away with targeting XHDPI and let the scaling handle it, but that can leave noticeable artifacts for XHDPI->HDPI. If you need a quick and dirty iOS to Android port, converting @2x resources is pretty handy. Just make sure to convert stretchable resources (buttons, backgrounds, ect) to 9patch.
|
# ¿ Mar 15, 2013 08:47 |
|
Ethereal posted:Anyone with IntelliJ experience here? I ditched Eclipse for IntelliJ, it's really nice. How are you configuring the Project Structure section? You can use the Libraries section to reference regular jars, so it should have pretty much have everything from the libs folder. This combines all those libraries into a single reference. Under modules, the app module should have compile scope on the Library group and each of the Android library modules. The Android library module is mostly the same, it should reference module D if needed, and any jars thar are required for that library (ex: ActionBarSherlock references the support jar). If you get any duplicate definition errors, that's caused by having the same JAR referenced in two modules. Set the scope for that JAR to 'Provided' on everything but the first module that references it. Another gotcha that you may hit is that sometimes it'll fail to detect that an Android library project is a library, you can go to the Facets section and check the "Library module" box on that module.
|
# ¿ Apr 3, 2013 05:00 |
|
Ethereal posted:So there is no libs folder which complicates things. We have a language agnostic dependency resolution system that has collated all of our dependencies D into a project library. Well, when you include D in the compile scope of A, it should work fine as long as there isn't any kind of overlap in class definitions. See what class is referenced in the top-level exception. Somehow you are including it twice. The most common cause is a second android-support-v4 sneaking in there, or v4 and v13 overlapping. In a traditional structure, you would have most of the libraries you need compiled in the main app. Then you can just set any overlapping references to provided and you are set. It sounds like you'll need to work backwards to find the overlap here. E: This kind of TOP-LEVEL-EXCEPTION is one of the things that the ant build system won't fix for you, unlike Eclipse. Eclipse kinda works around certain build issues, like mismatched JARs and duplicate class definitions. If you fix this for IntelliJ, you'll also be a lot closer to having a proper Ant build and setting up a Jenkins build server. zeekner fucked around with this message at 06:48 on Apr 3, 2013 |
# ¿ Apr 3, 2013 06:42 |
|
Sab669 posted:Heh, well, I have absolutely no idea what I'm doing. I downloaded this sample and tried to mod it to fit my needs. That example is oriented for applications looking to quickly integrate a grab-video function, but it doesn't really record video like you want. You'll need to actually use the MediaRecorder class and follow this guide to get what you are really looking for. I haven't done any real work with video though, so I don't have much else to give here.
|
# ¿ Apr 11, 2013 05:41 |
|
What kind of issues are you guys running into that is forcing you to set minimum at 4.0? I just recently jumped up to 2.2, for push and other features. I've mostly had to contend with phone-specific bugs or Cyanogen/ROM-introduced issues, but otherwise I haven't had that much trouble maintaining backwards compatibility.
|
# ¿ Apr 22, 2013 03:34 |
|
j4on posted:This is a cross-release of an iOS app (sorry!) This is pretty much my entire project roadmap for the next year, so nothing to be sorry about. Does adobe air actually work worth a drat? Last time I heard someone use it to port an app over, it ended up a giant mess.
|
# ¿ Apr 22, 2013 05:16 |
|
Glimm posted:edit: I'm an idiot 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.
|
# ¿ Apr 24, 2013 00:25 |
|
Karthe posted:Thanks to version control I discovered that the problem was entirely due to PEBKAC. The two class files are in com.example.helpers, and I didn't realize that I was already importing my app's R in them before I updated the package name. I love IntelliJ, it's pretty nice and handles almost everything I need. The only issue I ran into is that their logcat does not filter by app package, so I use the monitor from the SDK. e: Just to give an idea of how well it's integrated, it'll detect if the activity isn't being referenced in the manifest and do the unused highlight on the class name.
|
# ¿ Apr 24, 2013 22:52 |
|
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.
|
# ¿ May 15, 2013 17:40 |
|
It looks like most of the Android Studio functionality will make it in IntelliJ 13, but that's not out till December. http://blogs.jetbrains.com/idea/2013/05/intellij-idea-13-early-preview-is-out/ Guess I'll have to try Studio and see if it's worth switching, hopefully the workspace config transfers over.
|
# ¿ May 15, 2013 21:30 |
|
They just posted the recorded Volley video if anyone missed it. I'm really excited to try this, it'll replace a ton of code and libraries for me. https://www.youtube.com/watch?v=yhv8l9F44qo
|
# ¿ May 16, 2013 18:20 |
|
|
# ¿ Apr 28, 2024 10:01 |
|
Haha, nice. I'm going through the volley library now. It seems pretty cool, but the lack of examples is pretty annoying. It'll be nice to ditch the network service pattern I've been using. Switching existing code to the new structure is pretty straightforward, I'll probably switch for my current project.
|
# ¿ May 18, 2013 22:57 |