|
Volmarias posted:I straight up told you to do this oh you did and i forgot to click the link i'm literally retarded
|
# ¿ Jun 6, 2017 20:10 |
|
|
# ¿ May 14, 2024 08:08 |
|
I'm trying to verify that my app is receiving UDP traffic from port 12001 to rule out the app being broken and see if the device sending the UDP signals (a vehicle) is actually sending them. What's the best way to do this? there seems to be a lot of sniffers on the play store but they seem to require connection to a VPN and they seem to be dodgy. I need a solution that doesnt require a rooted device as well
|
# ¿ Jul 11, 2017 19:06 |
|
Vesi posted:these are two separate problems, you can test UDP receiving by sending data with for example netcat if you're in the same network it's for vehicle to vehicle communications so you can imagine what i'm dealing with
|
# ¿ Jul 11, 2017 19:31 |
|
I asked the big brains and the reason for using UDP is so vehicles can communicate their location quicker without worrying about a response packet and can get away with missing information.
|
# ¿ Jul 11, 2017 20:21 |
|
Ok boyos who wants so Stack Exchange e-points https://stackoverflow.com/questions/45090837/nullpointerexception-on-asynctask-execute dont let EE's write loving android apps
|
# ¿ Jul 13, 2017 22:14 |
|
baka kaba posted:I can't see which is line 61 of MainActivity (where you're calling a method on a null object) but I'm guessing you're meant to be assigning to an mListeningService field in onCreate instead of creating a local variable? Yeah I marked it here. The EE created the mAndroidUDP.startIt() method which looks like this Java code:
Here's the onCreate method Java code:
|
# ¿ Jul 13, 2017 22:46 |
|
baka kaba posted:Where's listeningService getting assigned in AndroidUDP? Java code:
They havent had real programmers in the company until like March and now that we have some down time theyre coming to us to fix their broken code that's due tomorrow at 3p pls can u make this work!!! My existence is pain FAT32 SHAMER fucked around with this message at 23:26 on Jul 13, 2017 |
# ¿ Jul 13, 2017 23:23 |
|
b0lt posted:You're sending imminent forward collision alerts via UDP? That's exactly what I said baka kaba posted:I haven't done a lot with services and there's a bunch of weird stuff in there (what's listeningService.intent1, I don't see that field? What's with creating a ListeningService with new?) that should stop it running at all, I'm guessing you're trying to cut out code so it's not all over the internets but it's hard to look through Thanks for this, I'll see how it goes tomorrow when I get in
|
# ¿ Jul 14, 2017 02:16 |
|
I decided to say gently caress it and instead of trying to use the listener as a service, just use an AsyncTask as an inner class of the main activity because it's a single activity app and there's no reason to overcomplicate it like the original guy did. Stupid question time: in the onPostExecution I understand that this would be where I set the text/image of my TextView and ImageView. According to this stackoverflow question quote:If this is an inner class of your Activity then initialize the View in the Activity then update it in your task as described above.
|
# ¿ Jul 14, 2017 22:43 |
|
baka kaba posted:They're saying hold the reference in the activity class, initialise it with findViewById when the activity is setting up (like in onCreateView) and then just refer to that from your AsyncTask If I reference it from onCreate that causes a static/nonstatic error, wouldn't it?
|
# ¿ Jul 14, 2017 23:26 |
|
baka kaba posted:Nah you have a non-static TextView field or whatever in your activity, assign it when you can grab a reference to the actual View after it's been inflated. onCreateView is the best time to do this - inflate your layout, do your findViewById stuff to pluck out the Views you want references to, then return the inflated layout view as usual Ahhh that explains a lot. I always forget about the difference between the two
|
# ¿ Jul 15, 2017 05:01 |
|
So I successfully got my AsyncTask working and it receives the data that is pinged to it and changes the ImageView and TextView based on what the message says when parsed. It works almost exactly how I'd like it to except for one problem: you have to press the button multiple times, which means if the packet data changes, you have to be clicking it quite frequently to get the update. I attempted to use a ToggleButton with a while loop to continuously run the AsyncTask while the ToggleButton had .isChecked = true, however as you can imagine this caused it to crash due to what I assume was too much data on the UI thread. So based on this, I believe that I need to rewrite this as a service so that it can run on its own thread and not kill everything. This is what my AsyncTask currently looks like: Java code:
edit: I guess this would work? https://gist.github.com/finnjohnsen/3654994 FAT32 SHAMER fucked around with this message at 17:15 on Jul 18, 2017 |
# ¿ Jul 18, 2017 17:04 |
|
Volmarias posted:Without looking at or caring about any of your code, I'd like to point out that you can start a new thread from an Activity, it doesn't actually need to live in a service unless you'd like it to persist when the Activity goes away for some reason. baka kaba posted:Yeah if you're rewriting it I'd ditch the AsyncTask which is really meant as a quick way to do something off the UI thread and deliver the result on it. oh yeah I guess that's a great point, no need to abstract something like this when I can just have it run on it's own since nothing else will be using it. thanks for the tips and for putting up with my dumbass questions
|
# ¿ Jul 18, 2017 21:31 |
|
Volmarias posted:No problem. That was the idea, the UDP messages are sent every 1/100th of a second and constantly changing due to a vehicle possibly changing position switching a potential alert from standard to imminent. I had it on every button press because the AsyncTask otherwise seems to crash the app when using a Togglebutton + while loop to check if the Togglebutton.isChecked() then running the AsyncTask from that Previous to your comments I wrote a service to handle the UDP traffic which runs on its own thread, and now that I have it binding it's not receiving the traffic so I'm making sure that i have it pointed at the right ports and all that jazz. FAT32 SHAMER fucked around with this message at 22:16 on Jul 18, 2017 |
# ¿ Jul 18, 2017 22:14 |
|
Volmarias posted:Without looking at or caring about any of your code, I'd like to point out that you can start a new thread from an Activity, it doesn't actually need to live in a service unless you'd like it to persist when the Activity goes away for some reason. So I've done this and as it turns out sending messages to the UI every 1/100th of a second will crash the UI thread no matter what I do. The listening thread is running fine and it processes all of the data thrown at it just how i'd like. I've been trying to figure out a way to update the UI every 1 second (since this is just a monitoring app to make sure that a vehicle is sending the correct messages and we're not testing for timing) I tried using a while loop when ToggleButton.isChecked = true to call the method in the MainActivity that fetches mListenerService.getParsedMessage and updates the TextView but that obviously locked the UI thread due to the while loop constantly looping while the button isChecked, then I tried putting the while loop in its own thread so that I can sleep it for a second but surprise surprise that didnt work either since now I can't call a method that works on the UI thread from a different thread. I've been messing with Handlers for a little bit but it still crashes the UI thread Java code:
How should I got about updating the UI without crashing it? Instead of trying to call the method that works on the UI thread, should set a global String to the value of the mListenerService.getParsedMessage and update the objects from that? I feel like I'm on the cusp of fully understanding this after reading about all this stuff last night when I got home Edit: better way to phrase it: how can I call a method that works on the UI less often than however quickly it's currently being called FAT32 SHAMER fucked around with this message at 23:12 on Jul 19, 2017 |
# ¿ Jul 19, 2017 23:01 |
|
Volmarias posted:Posting to the UI thread every 10ms won't cause a crash. You're doing something else wrong. Post the stack trace and relevant code along with line numbers. There's no stack trace, the UI simply stops responding then five seconds later I get the "your app is unresponsive" dialog box MainActivity Java code:
ListenerService. Java code:
|
# ¿ Jul 19, 2017 23:48 |
|
Volmarias posted:You have a while loop in your listener. Why? Volmarias posted:You've diagnosed the issue. The problem is that you need to return from the listener call so that the rest of the work on the UI thread, like the drawing, can happen. I'm gonna mess around with this idea and do a runnable class since making it a service seems to also make it a pain in the dick kitten smoothie posted:Even after you get that off the main thread, why are you closing and re-opening the socket every time you get a message? Just leave it open and keep reading infinitely. It'll block the listener thread while waiting for data to come in, so when you're done close the socket from outside that thread. Ignore the resulting IOException, because you'll get one from closing the socket out from under a blocking receive call. baka kaba posted:You want something like this
|
# ¿ Jul 20, 2017 12:11 |
|
So idk how terrible this is, but I figured out a stupidly simple way to redraw the textviews and imageview all the time and it works extremely well. I simply used Animation's applyTransformation. I've had the app running for about an hour with no issue, so fingers crossed it is good to go. edit: here's the code Java code:
FAT32 SHAMER fucked around with this message at 18:33 on Jul 20, 2017 |
# ¿ Jul 20, 2017 18:30 |
|
Volmarias posted:
nonono it's all good, I realized that while this works it's a terrible way to do it and I implemented the handler as was shown by baka. I have much to learn
|
# ¿ Jul 20, 2017 21:24 |
|
kitten smoothie posted:Your listen thread is a while loop. I'm not sure why i didnt recognize this but that explains a few questions i had in the back of my mind baka kaba posted:Honestly after the initial about doing it through animations, I realised you're basically updating views on a tick and one of them is animating a fade anyway. So you're really polling for data when the animation has faded out, so you can switch the content while it's invisible. This was my initial thinking as well. I'm not sure how terrible it is either but i'd rather do something correctly and learn it so I know for the future instead of do a potentially insane hack to make it work Do you guys have any resources with projects I can work through in my spare time? I got about halfway through the big nerd ranch android book i bought about two years ago and while it was insightful, I wasnt sure how useful some of the stuff would be due to a lot of deprecated things (like apparently SoundPool)
|
# ¿ Jul 20, 2017 22:53 |
|
kitten smoothie posted:The BNR book is still probably one of the best resources for "I can write some Java but need to understand the Android framework." They put out a new edition in January so I'd imagine the outdated stuff is gone now (for instance it looks like the only thing deprecated about SoundPool is the constructor method, not the framework class itself). Nice! Thanks for this, and thanks for all the help and insight you guys have given me in the last two weeks. Pray for me because i'm the only person on my team familiar with Java and Android (they all did C# in school and I did Java datastructures/android apps and iOS apps)
|
# ¿ Jul 21, 2017 15:33 |
|
Volmarias posted:Java is pretty similar to C# (I think of C# as Java With Hindsight), so transitioning isn't terrible. That's what I told them. I guess they'll learn it if they absolutely have to, but since we work in automotive their big focus is C/C++ and C#
|
# ¿ Jul 21, 2017 23:01 |
|
Ok guys I have a super dumb question (again). The last time I built a [complicated multi-activity] app, Fragments didn't exist and everything was straight forward. I've built a NavDrawer based on this tutorial that i found that isn't garbage and it works great A++. Now my question is, do i build my UI in fragment_layouts for each fragment or do I have to do some kind of interface so that the fragment "becomes", for lack of a better word, an activity. For instance, here is the drawer that I've built. (i'm fixing the padding at the top pls ignore) If I click on "Completed", it crashes if it extends AppCompatActivity but it is fine when it extends Fragment, which I guess makes sense. The tutorial has my MainActivity extending AppCompatActivity, however based on the android developer I should be extending FragmentActivity. Should I be extending both? Should I do some kind of fuckery to make the navdrawer launch activities instead of fragments? Thanks
|
# ¿ Aug 22, 2017 17:25 |
|
baka kaba posted:AppCompatActivity inherits from FragmentActivity - use the AppCompat version because it basically gives you a lot of the modern look and other stuff in older versions of Android. Awesome, thanks a lot
|
# ¿ Aug 22, 2017 18:35 |
|
kitten smoothie posted:Samesies. I guess if you get off on dealing with bugs from multiple layers of lifecycles they're cool. ok holy poo poo am i glad I just finished converting my fragments to activities
|
# ¿ Aug 22, 2017 21:34 |
|
My only complaint with activities over fragments is that the activity comes from the bottom of the screen and (as far as I can tell) I can't make the drawer highlight + make the current activity unclickable/not destroy+create itself when clicked w/e though I'm not about to spend three weeks figuring out UI bullshit when I have a fuckload of stuff I have to figure out on the backend
|
# ¿ Aug 23, 2017 05:31 |
|
Volmarias posted:I have tried but simply cannot figure out what you mean by this. I'll record it tomorrow
|
# ¿ Aug 23, 2017 06:03 |
|
baka kaba posted:You just need to set up the menu for each activity, once the navigation drawer is initialised you can do getMenu() to poke around in there and find the item you want to change. You probably just want to look it up by id and then do setEnabled() to false. Usually you'd do something like setItemTextColor() to define what things should look like in states like disabled (or you can set that in XML) Ahhhhh ok derp. Here's a gif of what i was talking about https://giant.gfycat.com/AnnualColorlessKakarikis.gifv edit: ok the world of animations is fun and exciting and the normies are going to love these FAT32 SHAMER fucked around with this message at 15:41 on Aug 23, 2017 |
# ¿ Aug 23, 2017 15:35 |
|
baka kaba posted:Looks like I forgot to actually link the stack overflow page but sounds like you found them anyway! Yeah, cheers
|
# ¿ Aug 24, 2017 04:08 |
|
John F Bennett posted:Unrelated to things in this thread but what software do you use to create such a nice gif of your screen? haha yeah, i built a new computer at work and havent installed all my software and didn't realize it until i went to record my screen
|
# ¿ Aug 24, 2017 12:09 |
|
Completely unrelated, is UnboundID the best LDAP lib for connecting my app to my company's LDAP server? I checked out something called Auth0 but they seem to be offering to host a new LDAP server instead of just giving me APIs to use to handle auth stuff
|
# ¿ Aug 24, 2017 16:46 |
|
Seriously tho if you're doing vehicle stuff then me and u are now Postin Pals
|
# ¿ Sep 6, 2017 04:00 |
|
Popete posted:Using Android in embedded systems is all the rage these days, customers love having a slick interface that everyone already knows how to use to interface with there in-flight entertainment or seat controls. Android is nice but there are times where it is an ungodly pain in the rear end and I wish we would have just gone with a more traditional OS. Having to mess with HAL's and frameworks is a mess that I'm not very good at coming from a micro controller bare metal coding perspective. Nah the lowest level I got to was loving around with the HVAC control system and trying to figure out how it talked to the CAN/LIN buses lol Based on my experience with OEMs building a full OS in house I'll put up with androids quirks any day
|
# ¿ Sep 6, 2017 04:52 |
|
b0lt posted:Are you seriously shipping a froyo device in 2017? android dot text ok here's a question regarding views and dynamically adding textviews into them. I'm building a sidebar that will load in categories from a Firebase, and when an item is clicked it will show subitems, like this (except without the radio buttons) It has three columns: categoryName, completed, and score. When you click anywhere on that header it will turn grey to show that it is selected and show the subcategories and if they're completed or not. I was attempting to do this by hiding a view containing the subcategories and unhiding it with an onClick of the view like this Java code:
I made a layout specifically for the categories here: XML code:
XML code:
EDIT: ok turns out an ELV will solve all of my problems and i'm a gigantic dummy FAT32 SHAMER fucked around with this message at 20:16 on Sep 6, 2017 |
# ¿ Sep 6, 2017 18:47 |
|
I dont use a physical device for android, just the emulator. Do that, unless your PC is slow to begin with also, can anyone explain why the hell this is happening when i click on an EditText that is inside an ExpandableListView? https://giant.gfycat.com/GenuineUnluckyHyrax.gifv To me it looks like the toolbar is extending over everything, but maybe it's a weird quirk that has a quick fix? FAT32 SHAMER fucked around with this message at 21:13 on Sep 12, 2017 |
# ¿ Sep 12, 2017 21:09 |
|
kitten smoothie posted:Tried looking in the Hierarchy Viewer for where the views went? How would i look to see where the views went? Heres what it looks like (EditText is highlighted)
|
# ¿ Sep 13, 2017 16:39 |
|
Tunga posted:It's not doing something weird related to the input type is it? On phones TextViews can do this weird fullscreen thing unless you set flagNoExtractUi on them. This shouldn't happen on a tablet though. Hmm, I don't think so. I'll try the flagNoExtractUi thing and see what happens, but I would assume that if they were expanding, the background would be the colour of the TextView instead of something else edit: also for some reason when i click on the edit text then click out of it I can no longer click on one of the boxes (or at least, it makes the click sound but it doesnt change the color to highlighted) Edit two: I think the issue is going to be resolved if I convert my activities to fragments, based on what I'm reading Ugh FAT32 SHAMER fucked around with this message at 19:23 on Sep 13, 2017 |
# ¿ Sep 13, 2017 18:18 |
|
You can still build activities and not have to worry about the device's screen size, i'm more concerned given the complexity of the app that i'm building vs the pain in the rear end ratio of rewriting my activities to fragments and debugging this weird edittext issue. I could rewrite it in fragments and still have the two bugs that i'm currently experiencing, which will be hard to justify as i slink farther behind
|
# ¿ Sep 14, 2017 00:57 |
|
kitten smoothie posted:The view properties tab is helpful for looking at layout dimensions and such for a given view. This is the ActionBar before clicking on the EditText After: For some reason it's expanding the height to 996 even though I've set android:maxHeight="?attr/ActionBarSize" Here is the first view that gets wonky And to the left of the red line/arrow here is where it continues to be wonky, all the way to the root of all the views I'm currently looking at my inflation methods in my BaseActivity that I wrote so I dont have to write so much boilerplate and other activities can inherit from, so fingers crossed I find the issue. I wonder if my CustomExpandableListAdapter inflaters are loving something up with the inflation of the ActionBar FAT32 SHAMER fucked around with this message at 13:06 on Sep 14, 2017 |
# ¿ Sep 14, 2017 13:00 |
|
|
# ¿ May 14, 2024 08:08 |
|
TURNS OUT ALL I HAD TO DO WAS CHANGE THE MANIFEST TO adjustNothing THANK THE GODS
|
# ¿ Sep 14, 2017 13:32 |