|
PiCroft posted:This is largely for my own sanity, but I'm curious about something. We want to gather touch data for an app and write the type of touch to a database. While we can get the touch type easily enough, I noticed there was a very handy looking function called actionToString() in MotionEvent that translates the touch type directly to a sensible string. For somer reason, any attempt to use it failed; intellisense didn't detect it, manually calling it results in unrecognized error and I can confirm it was indeed there in the source code (its build-in Android stuff). If it's not publicly available, you CANNOT rely on an OEM not loving it up. This has bitten me in the past. If it's public now, you can always git blame the reason from AOSP.
|
# ¿ Mar 27, 2015 14:59 |
|
|
# ¿ May 14, 2024 03:46 |
|
HardDisk posted:I'm developing an application that depends on a webservice that it is still undeployed and as such, it is only running on my local machine on localhost:5000. So far so good. adb forward lets you port forward if that's the bottleneck. Otherwise, run an emulator on your desktop if you can do the hardware acceleration and virtualization.
|
# ¿ May 5, 2015 02:00 |
|
HardDisk posted:Thanks, didn't know about adb forward. judicious use of adb commands also allows neat stuff like wireless debugging
|
# ¿ May 5, 2015 17:08 |
|
kitten smoothie posted:Is there any on-device way to simulate a poo poo network? I know you can do this in the official emulator, but I want to do this on a real device. If it needs to be rooted, that's fine, my development device already is. Facebook put out something recently to simulate awful network conditions with latency and packet loss, though I don't know how well it works.
|
# ¿ May 10, 2015 16:38 |
|
more like dICK posted:Coming back to Android after spending a long time with Java on the server. I have an existing Java client for a REST API that uses Apache HttpComponents, is there any issue using this instead of okhttp/retrofit? Related question, is there a good place to stay up to date on Android libraries and design? The apache libraries were deprecated in Android a couple years ago and will not be maintained going forward. Use the new hotness libraries instead.
|
# ¿ May 13, 2015 04:59 |
|
Sereri posted:Does anyone have a good idea for implementing something like this aside from a PopupWindow containing a Viewpager with 2 Fragments? I vaguely remember there being a library for this, but it might have been even pre-HC, so a PopupWindow with a ViewPager and 2 Fragments (or 2 Views even) might be your best bet.
|
# ¿ May 15, 2015 03:53 |
|
edmund745 posted:Yea it did install it. It just has a generic icon (I didn't provide any icon). And the page doesn't say it installed it. There's no concept of an installer vs a standalone binary such as in the Windows or OS X world; everything is packaged into your application, which you install via telling the device's package manager to install it (which you do via clicking "run" in Android Studio, or by clicking "install" in the Play store, etc). When you're "test-running" the app, you're installing it, or re-installing it if it was already installed. I'm not quite sure what you mean by "Android can't do anything with them." Android definitely can do something with them, but in the mobile world the concept of file browsers is somewhat archaic; applications know what files they need to know about and run them. Android, in particular, handles this design by having applications specify what kind of files they handle via intent filters (see the data tag you put in the intent-filter tags). A calling application will "open" a file by creating an Intent with a VIEW action (or whatever action is most appropriate) and the file as a uri. If you've installed a file browser application, attempting to open files will do exactly this. Additionally, content is registered with the MediaStore (either explicitly or passively), which exposes it to other applications who can find it by querying the MediaStore for content (Music, Photos, etc). This is how the Gallery apps work; they don't scan your filesystem, they're vended a ContentProvider with a list of image uris to display to the user. As far as things being stored online, well, it really just depends on the apps. Your camera stores its photos/videos locally. You can/should download your music and store it locally. If you install Kindle, Audible, etc, that content gets downloaded. But, we are in general moving towards a world that lives more and more online. Mobile just happens to be the leading edge here.
|
# ¿ May 16, 2015 03:17 |
|
edmund745 posted:I got my idiot game thing working, sort of. As far as I've gotten into it anyway.... This is probably a "tough cookies" kind of situation. The general rule of thumb is that language syntax is always lowercase, classes are CamelCase (first letter uppercase), and methods are camelCase (first letter lowercase). After a little while, you'll get used to the expected syntax and this will cease to be a problem. You should be getting a nice red squiggly under your if statement's line, so look there. There's the Oracle and Google (and Android!) style guides, which you can try following to keep the rest of your code consistent.
|
# ¿ May 27, 2015 02:05 |
|
Doghouse posted:So for our final college project, our 3-person group, for some reason, decided to do an Android application, which none of us have ever worked on. So we are in a bit over our heads. While you have an android app, it may make more sense to ask this in the general programming problems thread. You can always decide what your app skeleton structure is and assign parts to people to fill in the blanks.
|
# ¿ Jun 14, 2015 17:15 |
|
hooah posted:My adviser wants me to build a simple Android app that logs the accelerometer and location data. I copied the layout and main activity code from here (please tell me if that's horrible code to start with), so now I have start and stop buttons. I know I want to do the logging and sensor polling off the UI thread, but I don't really have any idea how to separate them. I think once I know that, I can read the documentation for polling sensors, and I can probably figure out how to write to a text file in Java. Check the documentation, but I think that the Location and Sensor callbacks occur off of the UI thread anyway. You said "polling". Is that what you want to do, or do you want your callbacks to just update your UI as appropriate?
|
# ¿ Jun 22, 2015 13:49 |
|
hooah posted:I do appreciate the help. I'd just used the search box at developers.google.com/android, since I didn't realize there's also developer.android.com. Which is annoying. ... How did you download the SDK?
|
# ¿ Jun 22, 2015 21:56 |
|
Suran37 posted:I'm working on an audio player app, because the few I have used in the past were slowly becoming buggy or have annoying "features". Are you sure that MediaPlayer is going to be sufficient? If it is, why were you mucking with 3rd party libraries? Consider whether you're going to have to mess with AudioTrack at some point. Use a Service to manage your player, or whatever you use to play audio, along with setting the service as a foreground service if it's long lived. Bind to your service from your activities for controls, etc.
|
# ¿ Jun 26, 2015 03:54 |
|
speng31b posted:Just released an update to the latest app I've been working on, a prototyping/design tool. Previously we just had simple wireframe support (think super-simple vector art). Now we've added interactive screen links sort of like POP, but without having to take pictures and whatnot. Anyhow I made up a dynamic transition system for the screen links that makes for a pretty neat video: That's... Impressive.
|
# ¿ Jul 1, 2015 02:14 |
|
In the SDK controls, you should be able to download the source for your target, as well as the images etc.
|
# ¿ Jul 3, 2015 04:58 |
|
Yeah, you're looking at the decompiled SDK target "source" (i.e. the stubs), when you should be looking at the sources you can download separately with your target. Your IDE should be able to target a different set of source files, but Android Studio should handle doing that already.
Volmarias fucked around with this message at 19:00 on Jul 3, 2015 |
# ¿ Jul 3, 2015 18:57 |
|
hooah posted:I don't think I quite understand how TextViews work. I'm able to read data from the accelerometer and send it to the log, but I can't get it to display. I have an activity that's called when the user presses the "start" button on the main activity; here's its layout: What's lastUpdate's starting value? Add a log line to the inside of that if block, or better yet a breakpoint. Does it reach there? Are your textviews visible? If you give them starting values, do you see them? Also, does your callback happen on the UI thread? Do you need to call postInvalidate for some reason?
|
# ¿ Jul 8, 2015 01:59 |
|
baka kaba posted:Well they're both hitting the same last update timestamp, right? Also you can set different update speeds when you register the sensor, remember Well you're not coding via the mobile device sooo...
|
# ¿ Jul 8, 2015 19:12 |
|
Use layout weights. Your bottom layout with buttons has height wrap_content and weight 0, your scroll view has height 0 and weight 1.
|
# ¿ Jul 9, 2015 16:26 |
|
Edit: never mind
|
# ¿ Jul 9, 2015 17:09 |
|
Hiding in app private storage. You don't have permissions to view /data. Write your file to external storage instead.
|
# ¿ Jul 16, 2015 02:27 |
|
Several things. 1) Without knowing what directory getDataStorageDir is putting your file, we can't really help you with that. 2) openFileOutput opens a file in app private storage. Lets assume that getDataStorageDir is providing an externally visible directory. code:
code:
code:
To open the file for writing, I'd recommend using FileOutputStream with a file argument directly, e.g. code:
|
# ¿ Jul 17, 2015 04:18 |
|
hooah posted:Ah, didn't read the documentation on that! This is going great. The only thing now is that it wrote the same motion data several times at the end of the file, but that's not a large concern. Thanks for all the help! Did you register your listener multiple times? Make sure you mirror your registrations with deregistrations.
|
# ¿ Jul 18, 2015 02:26 |
|
hooah posted:I found the Handler constructor kitten smoothie was talking about, but suddenly I'm getting an error when I try to run my app over ADB: "Error: The activity 'MainActivity' is not declared in AndroidManifest.xml". I haven't changed that file in at least a couple days, and here it is: Something else broke. Uninstall your package, clean your build, and restart your device.
|
# ¿ Jul 20, 2015 02:47 |
|
Your file is in app private storage. Gmail doesn't have permission to access it. You can either change the permissions, or use a FileProvider to vend the file securely.
|
# ¿ Jul 30, 2015 23:52 |
|
I'm not even going to try to diagnose this. Just put your file in publicly visible external storage.
|
# ¿ Aug 3, 2015 00:13 |
|
hooah posted:How would that help? The URI seems to be accessible, it was just getting put in the wrong part of the intent. If you use a public external storage directory, there's no per-app permissions, so you wouldn't need a FileProvider, you could just give the file uri from there. Glad to hear you got it working though!
|
# ¿ Aug 4, 2015 00:17 |
|
hooah posted:I'm working with another student on this app, and he's mainly doing the data analysis stuff. He told me today that sometimes the same simple movement (perhaps sliding the phone in one axis on the table) will appear on different axes in his visualizations, and other times different movements will appear on the same axis. We've both looked at the linear acceleration documentation, and it doesn't say anything about this. Where should we start looking to figure this out? Look at the orientation of your phone as you move it. If you move it sideways, that will give you a different bump than moving it longways. I also would not be surprised in the slightest at an OEM screwing up which axis gets reported.
|
# ¿ Aug 15, 2015 03:01 |
|
Oh man, you just heard about that? A friend of mine still works for Samsung, and had to explain Unix permissions to their security team and why this was such a bad thing. I poo poo you not. Apparently they've gotten a little better since then, though apparently not by much.
|
# ¿ Aug 17, 2015 04:18 |
|
Subjunctive posted:Yeah, I haven't been paying attention to Android for a couple of years, and now I feel like I need to go back and binge-watch all the episodes. It's definitely entertaining in a train wreck sort of way. The current issue of the month is vulnerabilities in the stagefright media library allowing to RCE at system level via a well
|
# ¿ Aug 17, 2015 12:37 |
|
kitten smoothie posted:Oh, and don't forget that the patch didn't fully patch the problem. I actually have both a personal iPhone and a work Android phone. The iPhone has never quietly crashed in my pocket, unlike my Nexus 6, and the battery life is simply superior. The Android phone has fewer restrictions and let me do really fun and neat stuff, but at a price of letting everyone under the sun gently caress things up.
|
# ¿ Aug 18, 2015 01:14 |
|
That said, the media scanner may automatically scan things you don't want included, hence the requirement of adding a .nomedia file to directories with content that shouldn't get scanned.
|
# ¿ Sep 6, 2015 15:18 |
|
hooah posted:Is there a way to debug an app on a phone far away from me that's better than having the user install Android Studio and using TeamViewer to remote in to their machine? If the user is technical, you can have them enable wifi debugging and then ssh tunnel your adb connection to their host machine, but I feel like the number of users who could handle that and couldn't just follow instructions themselves to run adb bugreport > bugreport.txt is pretty tiny.
|
# ¿ Sep 12, 2015 23:03 |
|
PiCroft posted:I have a quick question on the Android Location framework - I notice it has a getTime() method. It uses whatever generated the fix used for that Location object. This means that it's also using whatever vendor code was written to generate the fix, up to and including the OEM that "enhanced" the hardware on someone's phone. I somewhat advise against relying on it (or anything else really), unless you can whitelist the devices you'll be using. It's PROBABLY fine, until you end up with the HTC Shitbird "helpfully" offsetting for DST or something. hooah posted:I did have them send a bug report from the settings menu, but my app shows up on logcat like three times, so that's not too helpful (assuming the person installed the verbose version). This'll be fun! Use a logging framework that allows you to log to disk, have them send the log file.
|
# ¿ Sep 14, 2015 14:22 |
|
Subjunctive posted:The API description seems pretty clear that it's UTC and has to be. If the fix were based on the system clock, then the location would be catastrophically wrong whenever the system clock drifted or was reset specifically; GPS depends on high-reliability timing to function. Manufacturers make mistakes that break CTS, then push out an update
|
# ¿ Sep 14, 2015 20:23 |
|
quote:Interesting, thanks. I guess it's also annoying that you can't reliably find out how old the fix is, since there's no way to get the current time as seen by the location system. (Which seems like the whole point of the fix time, but I guess it has other uses as well.) This was actually an obnoxious bug for me to deal with when writing GPS Notification. OEM sends two callbacks at a time (hell if I know why), one with the correct time and one with 0 and filled with junk. My solution was to discard any fixes with zero. Then, you get callbacks for like two minutes since the last actual fix but with the time that fix was at. OK, fine, discard fixes older than a minute. Then, you get the carrier giving your phone a time a couple minutes in the past, so the fixes are correct but there's a constant delta. Uggghhhh OK fine compare the timestamp against timestamps on the previous fix. Again, everything is technically up to spec, but weird behaviors cause problems.
|
# ¿ Sep 15, 2015 02:11 |
|
The application package name is probably com.company.myapp, not com.company.myapp.activities, although it's kind of poor form of them to put their activities into their own package. You'll want to do -n com.company.myapp/com.company.myapp.activities.SplashActivity
|
# ¿ Oct 21, 2015 12:42 |
|
Subjunctive posted:Why is that? I came across something else that said that recently, but didn't say what problem it avoided. I'm just getting back into Android development, so these sorts of gathered lore are interesting to me. There's no technical reason to do it or not to do it. I just feel like you shouldn't segregate your code out of the top level package for your project. That said my app does exactly that, but it's for build reasons alone, not by choice. Regarding the intent to start your activity, you should verify what the packagename is for your application via aapt dump badging, and make sure that your explicit intent uses that. Your application packagename might be something totally bonkers and unrelated. You may also wish to do adb lolcat ActivityManager:V *:F and then start your activity via the device launcher, which might be enlightening.
|
# ¿ Oct 21, 2015 13:59 |
|
hooah posted:I have my project stored on Google Drive and I'm using Android Studio. This is apparently a problem now when it wasn't a couple months back when I last worked on the project, since Google Drive insists on putting desktop.ini files everywhere, and AS chokes on them. Is the only solution to move the project out of my Google Drive folder? Maybe? You should definitely be using some sort of version control, and git is pretty ideal for cases where you're transferring the repo over a weird storage layer. Your filesystem is not an adequate version control solution. Yes, you should even be using version control for piddly projects and when learning.
|
# ¿ Nov 11, 2015 15:53 |
|
Subjunctive posted:So putting a git repo on Drive will work? Wouldn't it also get the desktop.ini files sprinkled in? You can basically back up a git repo into a single file, which you could place onto drive. It depends on how crappy you want your mechanism of source remotes to be. If you can use something like github, or have a shell somewhere, that's definitely the way to go.
|
# ¿ Nov 11, 2015 17:35 |
|
|
# ¿ May 14, 2024 03:46 |
|
Robolectric and Espresso. Robolectric is especially useful when possible, since the tests run directly on your computer via normal byte code, so they're VERY fast to compile and run. You should mandate tests regardless. See about generating coverage numbers too.
|
# ¿ Nov 27, 2015 02:30 |