|
Tusen Takk posted:SQLiteDatabase.OPEN_READONLY First step may be to change that.
|
# ? Apr 1, 2016 04:22 |
|
|
# ? May 14, 2024 06:07 |
|
Volmarias posted:First step may be to change that. Yeah, I began to realize that using a HashMap as the insert argument is really dumb. I have it working now and I think that it's working, I just have to write a test class to go back and view the entries to make sure it's actually creating a db locally since i'm using the VM.
|
# ? Apr 1, 2016 06:21 |
|
I'm back and with more questions! So I have successfully set up a database that lets me insert poo poo with no issues and everything is amazing. Now, I'd like to be able to display this information to the user, but I'm not sure how exactly to do it. This is what I've been using: SQLiteOpenHelper class Java code:
Java code:
XML code:
I also assume that the rest of the reason for the crash is because it doesn't want to write the data to the TextView, and if that's the case, how the heck to I display it to the user? Or is it because I'm returning Null in the getJournalEntries() method? Thanks for any help or input
|
# ? Apr 10, 2016 03:38 |
|
What does the stack trace in your log say? It should tell you exactly where it's crashing and why (the type of exception and the error message it carries), and then further down it will probably give you the exception that caused that, and maybe there's another one that caused that... Point is you don't really need to guess about it, there's a trail a clues right there which will at least point you in the right direction, show you which method crashed etc. You might need to google the error message to learn more but at least you'll be on the trail! This isn't a 'fix it yourself!' post, I'm just encouraging you to look at the logs because they're really useful (and it'll make it easier for people to help you when you've narrowed the problem down) Crash stack traces are logged at the Error level so you can filter logcat to display those and you'll find your app's crash really easily e- just offhand I can't see anything wrong with the XML (so the stack trace would really help to see why it's choking on setContentView), but your getJournalEntries method can return null, right? You do a null check but earlier in the method you call it again and immediately call a method on the result, so you need to handle it there too. It's probably a good idea to make sure the views you're findingById aren't null too. If you're using an IDE then the linter should be highlighting these and giving you a tooltip that says heyyyy this might be null - if you're in Android Studio then try putting the cursor on a highlighted bit and hitting Alt+Return, instant fixes! baka kaba fucked around with this message at 04:18 on Apr 10, 2016 |
# ? Apr 10, 2016 04:05 |
|
baka kaba posted:What does the stack trace in your log say? It should tell you exactly where it's crashing and why (the type of exception and the error message it carries), and then further down it will probably give you the exception that caused that, and maybe there's another one that caused that... Oh wow so that's what all of that is . Here's what it output for me: code:
Welp that makes life easy, the crashes were from having two textviews in one scroll view edit: I guess I have some SQLite syntax errors floating around and a few other easy fixes, so I guess that just leaves the question of what's the best way to getting the contents of your database into a textview or similar so the user can see it FAT32 SHAMER fucked around with this message at 04:37 on Apr 10, 2016 |
# ? Apr 10, 2016 04:34 |
|
If you're goofing with sqlite you will probably find this to be really handy as you develop: http://facebook.github.io/stetho/ edit: that said, "as you develop" is the operative phrase. Watch out not to accidentally have Stetho enabled in the production version you put up on the store. Maybe see some advice here for keeping it contained http://stackoverflow.com/questions/30172308/include-stetho-only-in-the-debug-build-variant kitten smoothie fucked around with this message at 05:02 on Apr 10, 2016 |
# ? Apr 10, 2016 04:59 |
|
Tusen Takk posted:So it says that it's crashing from Line 54 of PrevJourActivity.java, which is the line setContentView(R.layout.activity_prevjour);. Is it because "Caused by: java.lang.IllegalStateException: ScrollView can host only one direct child"? Yep! You should look at the docs for ScrollView, but it's basically meant as a wrapper around another view, so that if that view gets too big to fit on the screen (or the space you've allowed for it), the ScrollView will let you swipe it around. So if you want to have two TextViews, stick them in a Layout of some kind, and wrap the Layout in the ScrollView ('View' is basically the base UI component class if the name sounds confusing, it took me a while to get my head around it. So Layouts are Views too, you build your UI with them) As far as getting your stuff on-screen goes, it really depends how you want to display it and there are a lot of approaches you can take - some are a lot easier than others. Have a look at this, it's probably closest to what you have already: https://github.com/codepath/android_guides/wiki/Populating-a-ListView-with-a-CursorAdapter baka kaba fucked around with this message at 08:14 on Apr 10, 2016 |
# ? Apr 10, 2016 08:00 |
|
baka kaba posted:Yep! You should look at the docs for ScrollView, but it's basically meant as a wrapper around another view, so that if that view gets too big to fit on the screen (or the space you've allowed for it), the ScrollView will let you swipe it around. So if you want to have two TextViews, stick them in a Layout of some kind, and wrap the Layout in the ScrollView This is brilliant! Thanks so much for showing me this I edited their code for it to work with mine, but for some reason for every entry it also puts the button under it, like this: edited code! Adapter: Java code:
Java code:
XML code:
Thanks for all your help
|
# ? Apr 11, 2016 02:29 |
|
You need two layouts - one is for the activity, and that contains the ListView, which is like a special frame that makes a list. You put that wherever you want it on the screen. You also need a layout for your items in the list The ListView works by creating a View for each item in the list, which is what the Adapter handles. There are two methods you're overriding in there - newView() and bindView(). newView() is what's called when the ListView needs to create a new View to hold an item - you're inflating a layout to create your item's UI View, and that will go into the ViewGroup which is like an empty box in the list. "Hey what do I put in here" is what it's basically asking. This version is just inflating the same layout for every view, so they'll all look the same. This is where you need a layout that only holds your item's stuff - you're inflating the activity's layout again, so each list item has a mini activity layout in it, complete with button (and ListViews!) Aaand just so you know, bindView() is where the ListView actually needs to display an item's details, so that's where you find all the TextViews and such in your item's layout, and set them to info from the Cursor. The view that's being passed in is the one newView() created. So newView() makes generic list items, and bindView() puts the data in them. Because it's a CursorAdapter it automagically gets the record for each item (the Cursor is always pointing at the right one), other Adapters might give you a position on the list, and then you look up what item that refers to in a list or array or whatever
|
# ? Apr 11, 2016 03:53 |
|
I'm having problems with a custom view. The issue is that the segmented inner buttons in light blue are misaligned downwards and partially cut-off. I think it's happening because I'm miscalculating the dimensions of the outer arc during onMeasure(), but I'm not sure how I should go about confirming that. Relevant code below, project is here. Code is in C#/Xamarin, but I can do a quick translate to Java if necessary. XML code:
C# code:
C# code:
C# code:
Literal Hamster fucked around with this message at 00:03 on Apr 12, 2016 |
# ? Apr 11, 2016 20:59 |
|
baka kaba posted:You need two layouts - one is for the activity, and that contains the ListView, which is like a special frame that makes a list. You put that wherever you want it on the screen. You also need a layout for your items in the list This did the trick, thank you!! And much to everyone's relief, that finishes our senior project app, so I probably won't be bothering you guys much now
|
# ? Apr 12, 2016 03:22 |
|
We released ReDex today, a bytecode optimizer for Android apps. It takes in an APK and produces an optimized one. 25% improvements in speed and size aren't uncommon. http://fbredex.com/ is the main site. https://code.facebook.com/posts/1480969635539475/optimizing-android-bytecode-with-redex is the post where we first announced it, which describes some of the optimizations it performs.
|
# ? Apr 13, 2016 14:49 |
|
Subjunctive posted:We released ReDex today, a bytecode optimizer for Android apps. It takes in an APK and produces an optimized one. 25% improvements in speed and size aren't uncommon. Nice Are those comparisons against "plain" compiled code, or is that being compared against the same app with Proguard's optimizations? Does running something through Proguard impair later optimizing it with redex?
|
# ? Apr 13, 2016 15:19 |
|
Jabor posted:Nice Versus Proguarded code, since that's what we use on our apps.
|
# ? Apr 13, 2016 16:41 |
|
That's pretty impressive. Is there a similar performance gain if you're just using redex (without proguard)? The reflection-aware optimizations seem really cool, but of slightly dubious value if you still have to tell proguard about everything you're doing there. Or do you just have proguard keep everything and let redex do all of the class renaming and dead-code removal? How fast is the actual optimization process? Is it feasible to use on dev builds?
|
# ? Apr 13, 2016 16:48 |
|
Jabor posted:That's pretty impressive. I would expect bigger gains vs non-Proguarded, but I can ask. The internal post I'm reading is somewhat old (enough so that I want to recheck my vs-Proguard claim). I'm not sure what the best practice is for DCE, but I suspect it's letting ReDex do it all. ReDex's optimizations are a superset. Speed I don't know off-hand, will depend on size of app, but we're pretty sensitive to build time.
|
# ? Apr 13, 2016 22:28 |
|
I'm building the firmware side of a BLE interface and trying to debug an issue with Android. The short version is that Android doesn't listen for notifications before writing to a characteristic. iOS does, LightBlue does, and Android works fine if one of those runs first. The code looks like: code:
On the embedded side, I don't actually see the descriptor write come through. I'm confused enough by how this is all set up, it seems like they're discovering services all the time, and there's a lot of un-registering for notifications to get around the KitKat limit of 4, but MTU limitations have pushed us to Lollipop anyway. I'm single stepping over these things and not seeing the descriptor transaction making it across. I'm stuck, I'd welcome whatever suggestions come up. JawnV6 fucked around with this message at 02:36 on Apr 14, 2016 |
# ? Apr 14, 2016 02:07 |
|
Some bluetooth profile implementations support indications and not notifications. you'll need to check and use indications as a fallback if notifications aren't supported. sorry about that. here's a snippet that should point you in the right direction.code:
|
# ? Apr 14, 2016 02:57 |
|
speng31b posted:Some bluetooth profile implementations support indications and not notifications. you'll need to check and use indications as a fallback if notifications aren't supported. I wrote the profile on the device. Do you mean Android implementation? Like its phone specific if I can even ask for notifications? The firmware is hardcoded to check for 1, 2 won't work on that side. e: Our EE figured it out. Difference in RESPONSE/NORESPONSE, Android was using "write command" instead of "write request". Thanks for the pointers! JawnV6 fucked around with this message at 16:17 on Apr 14, 2016 |
# ? Apr 14, 2016 03:49 |
|
I'm idly thinking about doing an Android app again for the first time in years. Lately I've been doing a lot of web work with React...does anyone here have anything to say about React Native for Android development?
|
# ? Apr 14, 2016 19:19 |
|
I took a community college class on Android but the textbook was pretty garbage, and I like to have reference books for that kind of thing. Does anyone have a good recommendation for a reference for Android programming?
|
# ? Apr 14, 2016 19:44 |
|
StashAugustine posted:I took a community college class on Android but the textbook was pretty garbage, and I like to have reference books for that kind of thing. Does anyone have a good recommendation for a reference for Android programming? I wouldn't really call it a reference book but I got Big Nerd Ranch's Android Programming book and it took me from knowing jack poo poo about Android to writing a decent app and laying foundations for more complicated things/indepth complicated things in the course of three weeks. Probably quicker if I had devoted more than a few minutes a day to it.
|
# ? Apr 14, 2016 20:21 |
|
Hey android peoples. This semester's group project is in android which our group is "learning" as we go. We are pulling from a movie database and allowing the user to bookmark movies. I began coding the bookmark portion, and currently my solution to saving their bookmarks is to write to a file the movie id (I'm using http://www.androidinterview.com/android-internal-storage-read-and-write-text-file-example/ this as a guide). Is this the best way to save stuffs?
|
# ? Apr 15, 2016 00:23 |
|
Thom ZombieForm posted:Hey android peoples. This semester's group project is in android which our group is "learning" as we go. We are pulling from a movie database and allowing the user to bookmark movies. I began coding the bookmark portion, and currently my solution to saving their bookmarks is to write to a file the movie id (I'm using http://www.androidinterview.com/android-internal-storage-read-and-write-text-file-example/ this as a guide). Is this the best way to save stuffs? No, use a database. http://developer.android.com/training/basics/data-storage/databases.html
|
# ? Apr 15, 2016 00:33 |
|
Counterpoint: write a JSON file of the IDs in an array, read it at startup. Keep it sorted if you want to search more quickly. SQL is overkill, complexity you don't need right now.
|
# ? Apr 15, 2016 13:04 |
|
Thanks guys. I played around with both methods. I have one more question - and it pertains to the overall layout of the project, this is how babbys first android project evolved- - We started with three activities- one for searching movies (this is the main activitiy), one for accessing bookmarks, and one for changing settings. - From there we added classes for obtaining data, (model/adapter/async/listener stuff). (I don't have a firm grasp on the concepts here and need to find a good tutorial, but they work) - Then we learnt of fragments / retrofit / gson I am playing around / learning fragments at the moment, and hoping to alter the project (if not for app performance, then for learning) by A) having just one activity, which has a search, bookmarks, and settings fragment, and fragments for the api calls and B) Rebuilding the async stuff from scratch to actually understand it and then scrapping it for retrofit etc. I am mostly wondering if A) is a decent design decision, or if there's something to consider that I missed. I am very scrub and learning (java as well - I've only known c++ before this class) through lots of googling and official/unofficial android guides / android api.
|
# ? Apr 16, 2016 06:52 |
|
Fragments basically suck but so does everything else Google gives you. As far as I know these complaints still apply. Stick with model-view-presenter if you can.
|
# ? Apr 16, 2016 19:46 |
|
Has anyone here ever come across this: I have a webview that does not accept data via loadDataWithBaseURL(). It just stays with empty html and body tags. I can get the html code in via loadData() just fine but that won't allow me to load files from the asset folder. Interestingly it also works fine with loadDataWithBaseURL() on my phone with an updated system webview but won't work if I uninstall the updates. Still won't help with my non-updated emulator or system webviews.
|
# ? Apr 19, 2016 18:45 |
|
Sereri posted:Has anyone here ever come across this: I do it like this, it was done several years ago so I no longer remember why but it's been tested on hundreds of devices: code:
code:
|
# ? Apr 20, 2016 11:04 |
|
This is a total stab in the dark, but has anyone ever worked with displaying Jpeg2000 (.jpf, .j2k, .jpe) files in an Android app? I am an iOS developer, and loading j2k files was stupid easy on iOS, but all my Googling is telling me on Android, anything other than like two image formats, jpg and png, requires linking poorly documented, barely maintained C libraries and something called NDK and I just can't believe that's correct. I actually expected Android to be way ahead of iOS on this. On iOS it's automatic. It recognizes the filetype automatically and just loads it into a UIImageView. Has anyone ever done this on Android?
|
# ? Apr 20, 2016 17:44 |
|
Vesi posted:I do it like this, it was done several years ago so I no longer remember why but it's been tested on hundreds of devices: Thanks for the reply. However my html code is generated at runtime. Also webView.loadDataWithBaseURL() for some reason does apparently absolutely nothing. The weird thing is that Awful.apk has 2 other webviews with mostly the same code and everything is working fine there. Only this one just doesn't want to play ball. I think as a last resort I might just load the javascript and css via stream from the asset folder and inline it into the html, then just use loadData()
|
# ? Apr 20, 2016 19:17 |
|
JawnV6 posted:I wrote the profile on the device. Do you mean Android implementation? Like its phone specific if I can even ask for notifications? Sorry for the super delayed response, my bad for not totally reading the question. I've implemented just about every permutation of bullshit on the Android side for BLE, but I've never done the opposite side, just worked with hardware teams on that. Didn't see that you had control over the profile on the other end. Glad you figured it out Not sure if this matters to you, but FWIW, this is one of those Android things where you really need to test on Motorola, Samsung, LGE, 4.3, 4.4.2, 4.4.4, 5.0, 5.1, 6.0+ - all of the above. BLE is ultrafucked on Android and every stack is a little bit different. It actually comes down to things like "if you gatt connect on the UI thread on a Samsung running 4.4+, it breaks in this way that delays connect by X ms but is recoverable, but if you do it on the LE scan callback thread it works rightaway, but breaks on Motorola in an unrecoverable way", and so much more fun like that. speng31b fucked around with this message at 01:25 on Apr 23, 2016 |
# ? Apr 23, 2016 01:17 |
|
Jake Armitage posted:This is a total stab in the dark, but has anyone ever worked with displaying Jpeg2000 (.jpf, .j2k, .jpe) files in an Android app? I am an iOS developer, and loading j2k files was stupid easy on iOS, but all my Googling is telling me on Android, anything other than like two image formats, jpg and png, requires linking poorly documented, barely maintained C libraries and something called NDK and I just can't believe that's correct. I actually expected Android to be way ahead of iOS on this. Conveniently enough, a friend of mine was working in this area. Check out https://code.google.com/p/jj2000 and https://github.com/izzytwosheds/jjlossless/ (his library), hopefully that helps.
|
# ? Apr 29, 2016 12:54 |
|
speng31b posted:Sorry for the super delayed response, my bad for not totally reading the question. I've implemented just about every permutation of bullshit on the Android side for BLE, but I've never done the opposite side, just worked with hardware teams on that. Didn't see that you had control over the profile on the other end. Glad you figured it out Thanks for this. It's confirming what QA is hitting at the very least. I'm trying to work out happy-path scenarios for it (like once connected, rush to do absolutely everything) but getting reports from users that it's still wonky.
|
# ? Apr 29, 2016 19:45 |
|
JawnV6 posted:Thanks for this. It's confirming what QA is hitting at the very least. I'm trying to work out happy-path scenarios for it (like once connected, rush to do absolutely everything) but getting reports from users that it's still wonky. If you check back in post history in this thread, I made a ragepost about my implementation of it. Actually has some pretty useful details surrounded by rage if you care.
|
# ? Apr 29, 2016 20:59 |
|
Cross posting from the general android thread- disclaimer - we're a technical group who have cobbled together bits of code that work, but we do not have a background in code. We're a marketing agency that has built a presentation app in unity to aid in sales pitches that is getting some fairly serious traction, but we're starting to hit our limit in what we can code. We want to upgrade it, and plan to hire someone very soon, but first i want to understand what we're asking (and also if this sounds easy, hello give me a message!) Anyone here familiar with mirroring a unity app to another phone, or even just a piece of reference text that can say where someone is in it? no idea how difficult this is. it's so that someone using the app can be given a talk over the phone and given a properly directed sales pitch. I also have a few other questions for any seasoned developers, namely: How difficult is it to auto update unsigned apk's over wifi - and what do we need to use to host the apk files for this to happen? Our idea for the frontend website was a simple wordpress login/database template that links to a google drive. by the end of this year I see us having up to 100 users, who can choose from around 50 apk files to keep on their phone of various presentations that they swap in and out of as they please. We're going to recommend that they back the installers up rather than delete outright (file sizes range from 2-500mb each), so it'd need to auto update if someone installs from an old one - or wipe clean should it not be relevant anymore. kind of like a private app store, but hopefully not as expensive as that collection of words makes it sound. There's another thing we were thinking about - how possible is it to automatically generate an app that acts as a front end for these apk files? The idea being they'd go on our website and pick 5 of these presentations, name it, then get a link to download an app which when started is just a launcher for the 5 presentations. it would need to check that they already exist on the phone and make note of it, but it would provide a very clean way to show these without the user having to spend time sorting through apps moving them in and out of folders constantly. We do want to hire a coder to handle these as they're a little bit above our area of expertise. Would appreciate an idea of how difficult these things are, how long they'd take and how much it would cost a coder to get them running. If anyone here is or knows someone that could knock the first ones out easily then we've got a budget to get those done straight away. I figure the first 2 might be a little easier and the third is a little more involved (plus might need a reworking of the website?) I didn't post this in the straight up hiring a developer part because I guess what i'm after most is an understanding of what we're asking.
|
# ? May 2, 2016 21:36 |
|
Go ahead and put out a job posting for a mid-junior-level Unity or Android dev. This isn't a development question.
|
# ? May 3, 2016 00:04 |
|
speng31b posted:This isn't a development question. Ehh, it's develop-y enough that I'd say that this thread is the best fit to tell the poster what's needed (i.e. that they need a developer).
|
# ? May 3, 2016 00:50 |
|
Mission accomplished.
|
# ? May 3, 2016 01:20 |
|
|
# ? May 14, 2024 06:07 |
|
Kind of dick response. first and foremost I was asking if it was difficult, what it would cost and if the third thing was even possible. i just figured i'd mention that if anyone could bang out some of it in their sleep they could pm me. Shouldn't have mentioned it I guess. This: quote:How difficult is it to auto update unsigned apk's over wifi - and what do we need to use to host the apk files for this to happen? quote:how possible is it to automatically generate an app that acts as a front end for these apk files? The idea being they'd go on our website and pick 5 of these presentations, name it, then get a link to download an app which when started is just a launcher for the 5 presentations. it would need to check that they already exist on the phone and make note of it cubicle gangster fucked around with this message at 01:34 on May 3, 2016 |
# ? May 3, 2016 01:30 |