|
Search for "android ORM" and take your pick then. The first result for me was GreenDAO, which is a name I've heard before but I cannot give any recommendations.
|
# ? Nov 22, 2016 05:18 |
|
|
# ? May 28, 2024 11:32 |
|
Lutha Mahtin posted:I just cannot deal with making this brittle "data structure" (if you can even call it that) where all these ints just sort of happen to correspond to some array over there. I know there is probably a really easy solution to this, but I'm blanking on it. Please remind me of the very obvious class or combo that does exactly what I'm looking for here I guess it's specifically to avoid this pattern of grossness Java code:
If you understandably hate that and want to keep the direct references I guess you could set them when you first open a database, updating them whenever a method that changes table structure is called? Still pretty bad and it's the kind of thing generated code is good at, at which point you might as well start looking at the DAO libraries
|
# ? Nov 22, 2016 06:56 |
|
Edit:Nm, my answer is worse anyway.
|
# ? Nov 22, 2016 11:23 |
|
I'm writing my first android app. I'm trying to get my app to scrape a couple of web pages and as it scrapes, update a display with a link to some scraped data. The process to get the data takes more than a minute but less than five. Reading up on this, the best thing to do would be to create a service, is that right? And somehow as the service runs it can update the activity to display the data as it comes in?
|
# ? Dec 23, 2016 00:31 |
|
sausage king of Chicago posted:I'm writing my first android app. I'm trying to get my app to scrape a couple of web pages and as it scrapes, update a display with a link to some scraped data. The process to get the data takes more than a minute but less than five. Reading up on this, the best thing to do would be to create a service, is that right? And somehow as the service runs it can update the activity to display the data as it comes in? There are certainly some nuances to this stuff and there isn't one single way to approach it. *If you're targeting API 21 or newer (which in industry we don't generally have the luxury of doing but you may if this is just a personal project) you can use JobScheduler instead. If you don't care about it running while the app isn't visible (which seems like a bad idea if it takes several minutes to run but maybe you don't care) then you can just use an AsyncTask or spin your own solutions to do that on another thread.
|
# ? Dec 23, 2016 11:46 |
|
Worth also suggesting, if you're doing this quick and dirty, you don't need to bind to the service. Because the service runs in the same process, you could just have it publish it's results to some singleton, and notify the activity when something new is there. The activity refreshes it's view from that singleton in onResume or when it's notified. This way you don't need to worry about whether the callbacks are parcelable or anything. There's a lot of ways to do this, it really depends on your use case, whether you'll ever show this off, and how much you hate yourself.
|
# ? Dec 23, 2016 18:14 |
|
Volmarias posted:publish it's results to some singleton, and notify the activity when something new is there.
|
# ? Dec 23, 2016 20:28 |
|
Tunga posted:Keeping a reference to an activity in a sington sounds like a pretty good way to create a horrible memory leak. Unless I'm not understanding you. You are. I'm suggesting publishing ( "publishing" ) the data to a singleton that the activity can query, and which listens for broadcast intents. Otherwise, yeah, add/remove a listener as part of the life cycle of something but don't just straight up jam an activity in there.
|
# ? Dec 25, 2016 21:40 |
|
Volmarias posted:You are. I'm suggesting publishing ( "publishing" ) the data to a singleton that the activity can query, and which listens for broadcast intents. Otherwise, yeah, add/remove a listener as part of the life cycle of something but don't just straight up jam an activity in there. I preferred app-scoped or some-notion-of-session-scoped properties on a class, and calling that a Manager, Coordinator, or Controller (i.e. "FooManager", "FooCoordinator", or "FooController"), or maybe Listener or Announcer, depending on the specific thing it's doing. The broadcast intents method seems not unreasonable.
|
# ? Dec 25, 2016 22:46 |
|
edit: nvm covered up-thread
|
# ? Dec 28, 2016 04:57 |
|
Hi! I thought I'd try my hand at making an Android app. I'm decent enough with python but know jack squat about Android/Java. I've started out and got a few of the basics down, and I'm looking for a few pointers to where to go from here. Here's basically what I'm trying to do (but implemented as an Android app): https://chrome.google.com/webstore/detail/play-to-kodi/fncjhcjfnnooidlkijollckpakkebden?hl=en My idea is to make the app such that you'd be able to "Share" browser urls with it, which it then converts something kodi can understand (that part is dirt simple), and then tells a preconfigured kodi server to play using a few jsonrpc calls (1: get playlist id, 2: check if currently playing something, 3: if so stop it, 4: add url to right playlist, 5: start playing again from the right playlist). Hella straightforward. Or so I thought, before I looked here: https://developer.android.com/training/basics/network-ops/connecting.html Such bullshit! Then I found this: https://square.github.io/retrofit/ which seems to do roughly what I want. My questions: * Is retrofit any good? Is it still what the kids use these days? * How do I make a series of jsonrpc calls, where return values from one is input to the next? Do I make them all in series in a worker thread? How? Using AsyncTask? And retrofit? * How can I offer the user a way to cancel the operation, eg if it takes too long or they change their mind? * How can I update the main thread with status in between calls? * How do I easily make a simplistic gui with preferences config? I need a Main Activity I guess, and maybe a popup that displays status, and a preferences activity where you can set address, port, username and password to the kodi server. Do I design my own in Android Studio? I feel this should be so super common that there should be some shortcuts available that I'm not seeing. Thanks you guys!
|
# ? Jan 14, 2017 17:56 |
|
Retrofit is an excellent choice and Square have a strong track record of supporting and updating it and Jack Wharton is the poster child of Android developers. Because some idiot made a terrible decision two years ago my current project is still using Robospice so I'm not in much of a position to answer the more specific questions as I haven't used Retrofit for ages now and can't remember much about how it works. I'm sure someone else will be able to help though as it's a really popular library. For the last part check out PreferenceFragment or PreferenceFragmentCompat (or PreferenceActivity if you want to keep it old school).
|
# ? Jan 15, 2017 00:18 |
|
Tunga posted:(or PreferenceActivity if you want to keep it old school). I'm pretty sure you'll get deprecation warnings all over the place if you try using a PreferenceActivity in tyool 2017. I'd just use the PreferenceFragmentCompat like you said. It looks like someone's already built a library that talks to the json-rpc end of XBMC/Kodi so maybe worth giving it a try first. I didn't look at the code or anything to know for sure but it looks like they've generated types for all the various commands and responses. You'd need to do that yourself if you were talking to their API using Retrofit.
|
# ? Jan 15, 2017 01:01 |
|
Neat, thanks! I now have a server settings Activity with a PreferenceFragment in it, accessible from a top-right dotted Menu. Surprisingly painless. That XBMC JSON-RPC library for Android looks interesting, but it says in the description that it's "autogenerated" plus nobody touched it in 3 years? I might give it a spin to try it out, but really, isn't jsonrpc simple enough to just do, without a specialized lib for one service? Given that I'll just need a handfull calls, and am not trying to provide any kind of extensive functionality? Karate Bastard fucked around with this message at 09:53 on Jan 15, 2017 |
# ? Jan 15, 2017 01:39 |
|
Tunga posted:Jack Wharton Jake
|
# ? Jan 15, 2017 23:13 |
|
Volmarias posted:Jake
|
# ? Jan 16, 2017 00:09 |
|
Kind of a vague question, but are there any issues with Sqlite where it needs... warming up or something? There's a startup check in the Awful app, where it pulls the timestamp column from the first row in a table to see how old the data is. If it's too old then there's an update that ends up replacing the data. If the timestamp fetch returns null then the same thing happens The weird thing is, sometimes it returns null and sometimes it doesn't. The timestamp is always there, you can start the app and it will read fine and realise it doesn't need to update. Then another time you start it, with the exact same data in the db, it returns null (this is logged) which triggers an unnecessary update Anyone have any idea why it might be doing this? I'm probably going to just stick the timestamp in the app's preferences to fix it, but I'd like to know why it's breaking
|
# ? Jan 29, 2017 06:00 |
|
baka kaba posted:Kind of a vague question, but are there any issues with Sqlite where it needs... warming up or something? That sounds like an exceptionally exciting bug if you can even partly reliably reproduce it. Is it device/OEM specific? I wouldn't be shocked by a vendor "improving" SQLite.
|
# ? Jan 30, 2017 03:33 |
|
Hold that thought, I think something else might be loving with the table
|
# ? Jan 30, 2017 18:08 |
|
I'll ask later on Stack Overflow, but I thought I'd try here first. I have a Java project (all gradle) that I'm trying to add an Android Library module to in order to use Android-specific classes like Context, Activity, etc. I've run into a bunch of snags, and I think I'm close to getting it to work, but now I'm stuck. Building the Android module gives me "Duplicate file found: ../../../debug/R.java" and "Duplicate file found: ../../../debug/BuildConfig/BuildConfig.java" in the "generated" directory. Is there any way to prevent this? Perhaps disabling flavors and build types (since I only need one)?
|
# ? Feb 15, 2017 18:05 |
|
I don't actually know at all, but if you've tried cleaning your project and rebuilding, maybe you copied in some previously generated files when you added the module? The build process generates those files automatically, but if you have other copies in there (or in another source folder) you might get a conflict. It might be as easy as deleting them from those folders, but from googling around it could be a bunch of things
|
# ? Feb 15, 2017 23:13 |
|
Mezzanine posted:I'll ask later on Stack Overflow, but I thought I'd try here first. Are you using Android studio? Post your gradle file.
|
# ? Feb 16, 2017 02:45 |
|
Taffer posted:Are you using Android studio? Post your gradle file. Nope, it's a multi-module project in Intellij IDEA. I'm starting to think it's more to do with the module settings and such, but here's the relevant gradle stuff. top level settings.gradle code:
code:
I've tried various combinations of "excluding" everything in the "build/generated" and "build/intermediates" directories of the Android module, but it either gives me the "Duplicate class found: R.java" error or a vague "Error: 0".
|
# ? Feb 16, 2017 02:57 |
|
I have a three page app, a main page then two child pages which shows product pictures and descriptions. Page one works, so I copied the XML to page two. That worked. However when I started to change the image names on page two, none of the images are showing up when I build the APK.But they are displayed in Gradle. Any clue what would cause this funky behivaor? Edit: All images are in the drawable folder joebuddah fucked around with this message at 04:23 on Mar 18, 2017 |
# ? Mar 18, 2017 04:17 |
|
Hard to know without seeing any code, but maybe you're using the same IDs on the ImageViews or whatever, and there's a conflict? Try making sure your second page ones have unique ID names But really it could be a bunch of things depending on what you're actually doing. Seeing the XML and the code in the Activity and any Fragments would help
|
# ? Mar 18, 2017 09:46 |
|
I guess I should mention it here in case anyone lurking doesn't know: Jack's dead, baby
|
# ? Mar 18, 2017 09:48 |
|
joebuddah posted:I have a three page app, a main page then two child pages which shows product pictures and descriptions. Page one works, so I copied the XML to page two. That worked. However when I started to change the image names on page two, none of the images are showing up when I build the APK.But they are displayed in Gradle. Any clue what would cause this funky behivaor? Without more details we really can't tell you. What are the "pages"? Fragments? Activities? When you change the "image name" what are you changing, and are you changing it in code or in the XML or...
|
# ? Mar 18, 2017 14:20 |
|
I started using kotlin and it is amazing. You should all use kotlin.
|
# ? Mar 18, 2017 17:19 |
|
Taffer posted:I started using kotlin and it is amazing. You should all use kotlin.
|
# ? Mar 18, 2017 18:45 |
|
Is the debugger more reliable than it used to be? I would get crashes when hitting breakpoints and stuff.
|
# ? Mar 18, 2017 18:55 |
|
fleshweasel posted:Is the debugger more reliable than it used to be? I would get crashes when hitting breakpoints and stuff. I haven't had that issue. It's had some problems with being aware of when something is null, and some problems detecting anonymous inner classes, but it's still better than using java. Those problems are also probably made worse by me using the canary build of Android Studio.
|
# ? Mar 19, 2017 04:53 |
|
It was an image size issue. Once I resized the image it worked. Thanks
|
# ? Mar 20, 2017 16:01 |
|
Is there anywhere I can find documentation about Android's libc implementation? I've gathered that it's called bionic and found its git repository, but an actual searchable manual like glibc has would be pretty nice...
|
# ? Mar 21, 2017 20:05 |
|
VostokProgram posted:Is there anywhere I can find documentation about Android's libc implementation? I've gathered that it's called bionic and found its git repository, but an actual searchable manual like glibc has would be pretty nice... What do you need it for? It's not like you can develop against it or do you work for a device vendor?
|
# ? Mar 21, 2017 21:11 |
|
So the O preview is out apparently? https://developer.android.com/preview/api-overview.html A couple of nice features I can't wait to start using in 3 years.
|
# ? Mar 21, 2017 22:40 |
|
Vesi posted:What do you need it for? It's not like you can develop against it or do you work for a device vendor? You're aware of the NDK, yes? The NDK documentation (online and in the downloaded NDK itself) is as good as you're going to get, at least as far as guaranteed promises.
|
# ? Mar 21, 2017 23:51 |
|
Vesi posted:What do you need it for? It's not like you can develop against it or do you work for a device vendor? I can't say much but yes, we're doing some stuff that an Android OEM would normally do and I'm looking at ways we can test that serial ports, Ethernet, etc all work. Nothing I wrote would be shipped to customers, just used internally
|
# ? Mar 21, 2017 23:54 |
|
Volmarias posted:You're aware of the NDK, yes? NDK uses its own libc, I recall in a recent blog post they told developers not to rely on any system libraries to prevent conflicts. For OEM it's different of course, I'd just look at the source. It's mostly POSIX anyway with some platform-irrelevant stuff missing.
|
# ? Mar 22, 2017 01:22 |
|
Yeah, it wasn't clear from the original question, sorry.
|
# ? Mar 22, 2017 01:32 |
|
|
# ? May 28, 2024 11:32 |
|
OKay, this one is wacky and I apologize in advance if this isn't the right place to ask/is a dumb question. The goal: Get an arbitrary (e.g. already compiled, not made by me) Android app to display Chinese characters Background: I have an industrial/commercial coffee machine here that basically runs a modified tablet that runs an android app for the interface. I can customize this app by editing text files on an SD card. There are already several languages pre-defined, so what I'm doing is trying to copy how a language "works" in the existing app, and applying that to Chinese. I've hacked in the extra language, and am able to select it inside the app. The problem? The characters show up as what looks like Finnish gobblygook. There's a /FONT folder in the app, with a text file that lists which languages need custom fonts (existing ones being RUS and JPN). There's a sub-folder for each language in that /FONT folder. Inside the language folder (e.g. JPN) there are 4 .xbf files: code:
Based on some Googling, an XBF is apparently a binary of a XAML file, which I obviously don't have since I'm not the developer of the app. Is there a way for me to generate these XBF files in Chinese?
|
# ? Mar 23, 2017 21:53 |