|
Karthe posted:Is it possible to create a reference to an existing layout file in a specialized layout folder? For example, on the Nexus 7 I want to use a two-column layout when in landscape mode but a single-column phone layout in portrait mode. Can I create a reference to /res/layout/activity_layout.xml in /res/layout-sw600dp-port/ so that I only have to edit one activity_layout.xml file instead of maintaining a copy of it within /res/layout-sw600dp-port/? How SlidingMenu does it is how it's done. (https://github.com/jfeinstein10/SlidingMenu/tree/master/example/res/layout-large-land) You aren't going to be able to deduplicate the layout code but if you really really need to there is an include tag, I believe. If you have such need for ui reuse consider fragments.
|
# ¿ Jan 12, 2013 01:07 |
|
|
# ¿ May 13, 2024 03:11 |
|
it is posted:Maybe it's just because I'm trying to learn how to integrate Facebook into Android before becoming fluent in Android, but figuring out exactly HOW Facebook wants you to authenticate is extremely frustrating. This code (called from my MainActivity) Called from where in your MainActivity?
|
# ¿ Feb 6, 2013 23:40 |
|
it is posted:onCreate So you're creating another activity before one has had the chance to finish onCreate/onStart/onResume. This might not be a problem but it wouldn't hurt to check your assumptions. I would try creating a test button or menu that triggers the same function on that screen, then see if the same error is produced.
|
# ¿ Feb 7, 2013 02:08 |
|
Hmm, I can't really say for sure. Perhaps you're missing an argument somewhere. Whatever's happening, it's obviously expecting some data that ain't there.
|
# ¿ Feb 7, 2013 07:33 |
|
Above Our Own posted:I'm looking to develop in .NET for android. Is Xamarin's Mono for Android the most feature complete solution? I'm really wanting to spend as little time as possible porting. Above Our Own posted:I'm also doing a little XNA development on the side, and it would be nice to port this over to Android as well. I understand ExEn runs on top of Xamarin's platform, are there other options for porting XNA to android? Again, I really want to avoid having to write platform-specific code as much as possible and I'm willing to pay for that convenience.
|
# ¿ Feb 8, 2013 05:08 |
|
Karthe posted:Is a ContentProvider necessary when I'm just working with internal SQLite databases? I'm learning about them now and am left wondering if implementing one would be overkill; all I want to do is move database queries into a separate thread so the app won't hang. Right now I'm only querying static databases, though I will eventually implement another database that will be populated with user-generated content produced from within the app. I want to handle all of the database-related stuff in a database helper class, but everything I've read about introducing threading into the process points me to implementing a CP. Skip 'em to start with. If you need to load them asynchronously, there's a loader framework library by CommonsWare for providerless cursors.
|
# ¿ Feb 26, 2013 02:58 |
|
Karthe posted:Oh yeah, making the queries and processing the returned results isn't the issue. I was just looking for a simple way to do all of the queries in a separate thread so I don't freeze the app's UI thread. I'll try and do everything in the main thread for now - with luck I'll be able to get away with it. Use the commonsware library. It's only slightly overkill, not massive overkill like providers.
|
# ¿ Feb 26, 2013 08:35 |
|
The swapCursor(null) advice is correct to my recollection, but are you sure you're supposed to close it? http://stackoverflow.com/questions/8864813/if-and-when-to-close-the-database-when-using-commonsware-loaderex-sqlitecursorlo?rq=1
|
# ¿ Mar 2, 2013 10:03 |
|
Karthe posted:Is this something a fragment transaction could solve? I use it right now to bring up Fragment B in one-column mode, but as I write out this post I'm starting to think that I should dynamically load up fragments with FragmentTransactions in lieu of setting up my fragments statically in the activity's layout file... Yeah, pretty much. Load them up in FragmentTransactions. Also, remember that fragment state on the backstack is thrown away completely on configuration changes (such as orientation), though the backstack isn't destroyed. Just the state.
|
# ¿ Mar 7, 2013 02:35 |
|
It's been a while so the stuff is fading from memory. I do remember a few things:
|
# ¿ Mar 8, 2013 03:54 |
|
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. Use startActivityForResult/onActivityResult. stuff your data into an intent. Parcelable is better than Serializable when possible (Serializable uses reflection, and is slow; Parcelable requires you to implement a builder/parceler Protip: rather than calling startActivity or startActivityForResult, I usually make a class method that resembles: static void start(Activity activity, String arg1, SomeObject arg2) - or startForResult to indicate that it returns a result. It's much easier to find where an activity is launched from when all you have to do is find where a function is called from.
|
# ¿ Mar 12, 2013 16:41 |
|
Don't do activity life cycle stuff in onCreate IMO. I don't really understand what you want to do. You want orientation changes to back out of an activity? If that happened to me I would consider it a bug. What if someone is in a bumpy train ride and the orientation changes? What if you later decide to launch that activity from some other place where it doesn't make sense to close it?
|
# ¿ Mar 13, 2013 02:00 |
|
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.
|
# ¿ Apr 29, 2013 20:42 |
|
I have done both iOS and Android dev professionally for three years. PM me with some details and I'll make some time to get back to you about potential pitfalls, things to use, and stuff to keep an eye on.
|
# ¿ May 15, 2013 16:22 |
|
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!
|
# ¿ May 16, 2013 00:38 |
|
They said that they compared it to a bunch of other libs out there and that itwvperformance trounced the others'.
|
# ¿ May 16, 2013 00:56 |
|
jkyuusai posted:The "what the hell is Android going to do about new Java features since Oracle hates you" question came up during the keynote 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.
|
# ¿ May 18, 2013 21:24 |
|
Sereri posted:Wait, that was you? Yes.
|
# ¿ May 18, 2013 22:15 |
|
QuarkJets posted:Perhaps Google will provide expanded Python support and give Oracle the finger I doubt it and would hate for this to happen. I think the right move forward is to build a LLVM-based solution. Not only could they build first-class support* for writing Android apps on top of their already-present NDK platform (which already supports LLVM iirc), but if they could tie PNaCl in somehow, they could make the ChromeOS story instantly very compelling by providing a porting path between Android and ChromeOS. Python and other languages could simply sit atop LLVM and do their thing. * As in, not just a bridge
|
# ¿ May 19, 2013 21:37 |
|
Karthe posted:I've just hooked up a spinner in the Action Bar to a CursorAdapter (I'm cheating right now and am using a SimpleCursorAdapter, but will replace it with something custom). When an item in the spinner is selected, onNavigationItemSelected(int position, long id) is called. I know position is the tapped item's location in the list of items, but what is id? Is it whatever I returned as the _id column when I selected rows from the database? it's the primary key by which the item is identified. I just had an auto_increment field, I think. I'm not sure anymore what it's used for, but the most common error I've had with non-unique IDs and UI controls is the wrong UI control responding because it got called earlier than the one you intended to respond, because they have identical IDs. If you want something custom, try an ArrayAdapter subclass?
|
# ¿ Jun 7, 2013 21:09 |
|
Karthe posted:That's what I figured. In my case it's the row's _id column, which is perfect since I need to reference that when a particular spinner item is tapped. ArrayAdapters don't have to be static lists. In fact, the only way I've ever used them is as a destination for API-backed calls. No overhead of reading/writing to a database, just memory. It also frees you from being inseparably married to your SQLite code for any kind of data manipulation. That said, do what is simplest for what you need. POJO-backed lists is not necessarily that.
|
# ¿ Jun 7, 2013 22:30 |
|
more like dICK posted:What's the general pattern for an android app that needs a long running socket? I'd use HTTP, but the app needs to respond to arbitrary events from the server while the user is interacting with it. This looks like something that should be done with a service, but I haven't used those in the past. SPDY with server push and Square's Okhttp library?
|
# ¿ Jun 20, 2013 16:28 |
|
Karthe posted:Hell yeah, this was the missing piece of the puzzle! With them I finally able to figure out a way to helpfully block user interaction (via a dialogfragment) while database operations (or anything else long-running for that matter) occur on a separate thread. Thanks to you I'm almost ready for launch! Don't forget intent services
|
# ¿ Jun 27, 2013 00:14 |
|
Karthe posted:What's the difference between using a Thread versus using an IntentService to do something like, say, modify database schema?
|
# ¿ Jun 28, 2013 09:44 |
|
Sereri posted:But isn't it just dropping the ABS, including the library and removing all the Sherlock prefixes? It should be, but different code is different code and if you stick by "don't fix what ain't broke" (and conveniently ignore that Android itself is often broken), just stick with what you were already using. I haven't taken a look at Android in a while, but one useful thing I could imagine remaining useful is VPI (ViewPagerIndicator).
|
# ¿ Jul 25, 2013 08:10 |
|
Karthe posted:Do any of you guys have any experience with the Play Store's third-party translation services? I translated the UI of my Japanese dictionary app into Japanese but want someone native to proof-read it. I'm feeling bad asking friends to proof my stuff for free, so I'm considering shelling out a bit of cash up front to get a bona fide translation in place before launch. PM tarepanda. He should be fluent and know a thing or two about apps, I think.
|
# ¿ Aug 6, 2013 11:05 |
|
Karthe posted:Is it strange to put in an offline ad banner? Mobile connectivity is generally poo poo. Sacrificing usability to do right by your paying users in this way won't net you any more money, and it destroys your freemium funnel. That's two pretty lovely alternatives. Is there a third?
|
# ¿ Sep 3, 2013 00:56 |
|
Karthe posted:Honest question, am I sacrificing usability by placing a "tap here to get rids of ads" view that's the same size as an ad the user would see if they were online? The ad's not an interstitial, and it's only a 50dp tall TextView located at the bottom of the screen in the same container that an ad would appear. I misread. I thought your app disables itself if the ad doesn't fill. Yeah, just make it less convenient for free users vs paid users. People determined to not spend money will do many things to not pay. Doctor w-rw-rw- fucked around with this message at 01:31 on Sep 3, 2013 |
# ¿ Sep 3, 2013 01:19 |
|
Ulysses S. Grant posted:
Psh. You effectively have a 2.3 target and a 4.0+ target. That's a piece of cake next to the Eclair-Gingerbread-Honeycomb compatibility I had to do back in my day, when we had to walk uphill both ways (granted, in SF, you still generally have to literally walk uphill both ways). Gone are the days of lovely incomplete SQLite support, a missing String.isEmpty implementation, and poisoned HttpURLConnection connection pools. *shakes cane*
|
# ¿ Sep 4, 2013 00:53 |
|
Salvador Dalvik posted:Besides, Google's pretty much given up on core OS changes, it's all Play services and support library additions from here on out. Well, they moved core OS apps from the OS to the Play Store, more like. Makes sense that a lot of that stuff doesn't need to be carrier-certified and would benefit from a more iterative update cycle. I think having to live on their own platform will help them make it more livable for all of their developers. Now if only Android had an animation framework that didn't totally blow.
|
# ¿ Sep 4, 2013 02:33 |
|
Facebook's been using and improving Buck: http://facebook.github.io/buck/setup/quickstart.html Which can generate IntelliJ projects and is apparently working out really well so far. Just putting that out there.
|
# ¿ Sep 20, 2013 02:55 |
|
Jarl posted:When would you use the fragment backstack instead of the regular activty backstack? What is the Android way? I wouldn't use the fragment backstack because it throws away fragment state.
|
# ¿ Jan 3, 2014 17:01 |
|
Jarl posted:But fragment has onSaveInstanceState just like activity. Besides making it possible to save the state, even if the fragment is killed while another activity is active, this, to me, also implies that a fragment on the fragment-backstack is retained in memory until killing it becomes necessary. It isn't called in all situations. It's been a couple of years since I wrestled with this, but this might have been because of view pagers or fragment pager adapters not calling the state-saving methods - I don't specifically recall. Or perhaps some interaction with launching activities. In any case, I found it unreliable and broken.
|
# ¿ Jan 7, 2014 05:21 |
|
Karthe posted:Is there a way to read a single file from a ZIP file store in the /assets/ directory? I want to use ZipFile.getEntry() to dynamically grab a specific file, but I can't figure out how to get the ZIP file in a position to do that. A lot of guides and SO articles related to this use ZipInputStream to read the contents of a given ZIP file, but that involves iterating over every single compressed file to find the one you want. The ZIP file I'm working with has almost 6700 SVG files in it, that's not feasible. Iterating over 6700 small entries in a small contiguous range of bytes is not necessarily expensive, especially not if it's done once at startup and you cache the zip entries. In any case, assets are actually already accessed directly from within the APK, which is a compressed zip file, so you really don't gain anything by accessing a file-within-a-zip-within-a-zip. What is your rationale for zipping it up vs, say, putting it in a subdirectory of the assets folder vs. packaging it separately?
|
# ¿ Jan 10, 2014 01:32 |
|
Jarl posted:I have a stack A_1->A_2->A_3->B (A_1, A_2 and A_3 are all instances of the same activity A) and I want to pop back to the A_1 (root activity you will) without it being restarted it (i.e. onCreate being run), and hence with the rest of the stack finishing. Start the activities with an intent that includes a counter, and finish with a result code that signals the chain of activities should finish themselves until they hit the original counter of 0? Or just destructively do it as you start activities by finishing the predecessor at the same time, if I understand correctly.
|
# ¿ Jan 10, 2014 19:11 |
|
Unexpected posted:I have a newbie question (sorry). If I wanted to write a simple app that would work on both Android and iOS, do I create it on one platform (e.g. XCode on Mac) and then "rewrite" it for Java (as an example) or is there an application that would handle conversion "automatically". I know literally nothing about Android (and Java), so apologies if what I'm asking is retarded. Xamarin is the only environment with a realistic approach to writing native apps for each platform using the same language (without resorting to C/C++). The other environments typically offer you variations on a HTML/JS/CSS kind of environment, but it'll generally be very difficult even for moderately experienced developers to make a quality app that feels native on both. Having developed extensively for both Android and iOS. I can't recommend strongly enough that you should _not_ start on Android for a first platform if the choice is between Android and iOS. iOS is easier to get started on, more profitable, and more fun. Completely worth the price of admission.
|
# ¿ Feb 14, 2014 20:47 |
|
Karthe posted:I finished migrating my project to Gradle, but I compiled a release APK just now and noticed a couple of problems. The APK is 300% larger than when I was compiling it with ANT, and the Play Store now reports that this new APK includes localizations for every language, not just the two I actually have localizations for. Try unzipping the APK and running du -h on the directory to compare file sizes for a better idea of the difference.
|
# ¿ Feb 16, 2014 01:59 |
|
mod sassinator posted:Wow, great OP in this thread. I'm just getting started in Android development and found the info really useful. Friend of mine wrote this: https://github.com/depoll/bindroid
|
# ¿ Feb 21, 2014 20:28 |
|
mod sassinator posted:Awesome--I'm really impressed with Square's libraries. Those guys really seem to be on top of Android development. I should hope so. Bob Lee, their CTO, previously led core library development on Android at Google.
|
# ¿ Feb 22, 2014 22:53 |
|
|
# ¿ May 13, 2024 03:11 |
|
Tunga posted:Looks like Color.toString() doesn't have defined behaviour so probably avoid just putting the object in the log output. Elvis: -2^24 is 0xFF000000. In ARGB this means a totally opaque black. This means that red, green, and blue are consistently zero. Take a look at your constructor and you'll see you never actually set the instance variables. I assume you're new to programming, if not in general, then at least to Java. You would do well (generally) to recognize certain powers of two, and (specifically) learn how to use Java's debugger. Those will go a long way in helping you solve your problems in the future. Luckily, Java is one of the easiest languages to use a debugger with IMO, its other shortcomings aside. Doctor w-rw-rw- fucked around with this message at 08:55 on Mar 16, 2014 |
# ¿ Mar 16, 2014 08:32 |