**** BEGIN LOGGING AT Sat Sep 06 02:59:59 2014 Sep 06 03:23:38 linearlayout does that Sep 06 03:28:23 hello all Sep 06 03:28:52 pfn: can you elaborate? Sep 06 03:29:11 layout weight and height Sep 06 03:30:04 relative layout would do it too Sep 06 03:41:51 pfn: How do I programmatically add a fragment with a FragmentTransaction and also set its weight? Sep 06 03:42:33 you set it on the container you add it into Sep 06 03:43:36 right now I have this... point me in the right direction? http://pastebin.com/P9gCm5xn Sep 06 03:43:52 R.id.container is a LinearLayout Sep 06 03:48:40 should work Sep 06 03:49:11 It works, I just don't know how to set the gravity of the Fragments I'm adding Sep 06 03:50:02 what do you want to do ? Sep 06 03:50:03 exactly Sep 06 03:50:34 I want the media buttons fragment to take up the bottom 72dp of the screen, and for the channelfragment to take up the rest, above it Sep 06 03:50:58 http://stackoverflow.com/questions/3775705/android-set-the-gravity-for-a-textview-programmatically Sep 06 03:51:33 and what you want Sep 06 03:51:42 Probably relative layout is better anyway Sep 06 03:52:15 aling_toBottom or whatever it was Sep 06 03:52:21 alingParentBottom ? Sep 06 03:52:48 you can't do what that SO answer linked with a fragment Sep 06 03:53:10 MediaControlsFragment mediaFragment = new MediaControlsFragment(); mediaFragment. //dot what? Sep 06 03:53:35 A relativelayout would be wasteful for this Sep 06 03:53:58 relativelayout is faster Sep 06 03:53:59 but Sep 06 03:54:05 mediaFragment.setGravity ? Sep 06 03:54:11 not a method Sep 06 03:54:13 but way... Sep 06 03:54:17 *wait Sep 06 03:54:51 it doesnt make sense Sep 06 03:55:06 what you want is to set weight Sep 06 03:55:15 one to 0.7 and second to 0.3 Sep 06 03:55:17 or whatever Sep 06 03:55:26 true, but that's also not an available method Sep 06 03:55:57 you need to get LayoutParams first Sep 06 03:56:02 and then set weight to them Sep 06 03:56:06 http://stackoverflow.com/questions/3224193/set-the-layout-weight-of-a-textview-programmatically Sep 06 03:56:41 setLayoutParams also isn't a method of Fragment. Sep 06 03:57:17 http://stackoverflow.com/questions/12224433/can-i-set-layoutparams-to-fragment-by-programming Sep 06 03:57:19 maybe fragment.getView().setLayoutParams? Sep 06 03:57:38 okay, yeah Sep 06 03:57:47 let me try that Sep 06 04:01:07 ah damn it, I'll just use a relativelayout. Trying to figure out the dp -> weight conversion is too much work Sep 06 04:10:26 lol Sep 06 04:22:07 Is there a way to use fragmenttransaction to "stack" one fragment on top of another when calling add rather than simply overlapping them? Sep 06 04:25:57 nevermind, I'm dumb. Was using a framelayout that AS generated for me Sep 06 04:27:40 guys, there is any way to run code only if the device api is greater than a desired value Sep 06 04:29:26 you can use Build.VERSION to get the API level Sep 06 04:32:32 How can I change the background of this ListPreference? http://i.imgur.com/xlBcR6h.png Sep 06 05:11:12 Hey guys I was wondering, instead of stement returning true or false, is ther e a way I can make it return yes or no instead? Sep 06 05:11:23 statement* Sep 06 05:16:16 return a Sting? Sep 06 05:17:29 well basically im doing an if statement, and I just want on string to be filled with either yes or no depends on the if stement conditions and return it in a output Sep 06 05:17:56 thats basic java Sep 06 05:18:21 I still cant figure it out since I never had a reason for it. Sep 06 05:18:36 if(boolean) return "yes" else return "no" Sep 06 05:18:41 how can you not figure that out Sep 06 05:19:08 so I can put return "yes" instead of true? Sep 06 05:19:11 its that simple? Sep 06 05:19:22 your method would have to return type string Sep 06 05:19:41 return expression ? "yes" : "no" Sep 06 05:19:45 is a one liner Sep 06 05:19:55 actually I think I just got it. hold on Sep 06 05:20:05 this isnt difficult Sep 06 05:21:10 desming how long have you been programming in java? Sep 06 05:21:16 http://pastie.org/9531080 Sep 06 05:21:26 couple years Sep 06 05:21:38 I'm trying to do google oauth from scratch - it responds with error code 599 every once in a while. Does any one know what that means? Sep 06 05:21:50 ok Sep 06 05:22:18 "This status code is not specified in any RFCs, but is used by some HTTP proxies to signal a network connect timeout behind the proxy to a client in front of the proxy" Sep 06 05:22:25 probably not what youre looking for though Sep 06 05:22:43 desmin88, I found that. But how do I interpret that? What am I doing wrong? Sep 06 05:22:52 Searching didn't show much help Sep 06 05:22:59 why do people cry so much with reflection solutions... even android documentation suggest reflection to handle compatibility Sep 06 05:23:11 desmin88, The exact same code works flawlessly usually - every once in a while it fails. Sep 06 05:23:22 look at other google oauth implementations Sep 06 05:23:31 cliffreich: it depends Sep 06 05:24:33 usually its just that reflection is slower Sep 06 05:25:28 /can/ be slower Sep 06 05:28:47 oh Sep 06 05:29:23 yeah maybe a bit. some people overreact thou Sep 06 05:29:40 it's not flawless if it fails Sep 06 05:29:40 pfn pretty interesting http://www.infoworld.com/t/java-programming/scala-founder-language-due-fundamental-rethink-249845 Sep 06 05:29:49 it's just dumb luck that it works Sep 06 05:31:38 "This class was added in Android 4.0 (Ice Cream Sandwich). Use reflection to enable the response cache without impacting earlier releases:" Sep 06 05:31:45 android doc Sep 06 05:31:52 heh Sep 06 05:32:42 seen the same to handle handset custom stuff Sep 06 05:33:50 i thought Odersky's statements about the trends of fusion between OO + functional were interesting; he seemes to also think Swift borrowed a lot from Scala Sep 06 05:34:26 pretty cool stuff, i love these kinds of interviews when the language designers speak about what they are thinking :) Sep 06 05:35:10 fundamental rethink seems too strong of a term Sep 06 05:35:19 desmin I think what you linked wont help me, like how am I suppose to use that in a if stement, and second when I call my string it expects me to put an expression which I tried putting method(b) since boolean b but that doesnt work neither. This isn't as simple as you claim. Sep 06 05:35:52 string(b)* Sep 06 05:36:04 Odersky himself called it a fundamental rethink; although i'm not following close enough to know what exactly he had in mind beside things superficially mentioned here Sep 06 05:36:24 yo after this latest BNG4 update should I wipe cache or anything? My phones seems to lag now...... Sep 06 05:36:39 wrenny please read the topic :) Sep 06 05:37:03 not rooted Sep 06 05:37:48 sure, you can call modularity fundamental, but it's not so much a rethink Sep 06 05:38:25 g00s, see the screenshots of my updated acra collector? Sep 06 05:38:34 pfn no, link ? Sep 06 05:39:11 https://github.com/pfn/android_crash_reports/blob/master/README.md Sep 06 05:39:20 there are screenshot links there Sep 06 05:40:16 polymer is pretty neat Sep 06 05:40:31 frigging slow if you don't vulcanize, though Sep 06 05:40:58 yeah looks nice, i have to give polumer a try. i'm going through JS + d3 education, have to add that to the list Sep 06 05:41:33 a good analogy to polymer is mozilla xbl Sep 06 05:41:34 holy crap pfn you have a lot of tabs open :| Sep 06 05:41:45 that's not that many Sep 06 05:42:46 I also have 32gb of ram, so tabs aren't ever a concern Sep 06 05:43:07 * pfn zzz & Sep 06 05:47:47 Guys, i'm implementing service for messenger, i need a service that would always work in foreground and keep client online (despite of activity state). Thinking about how to organize start/stop of service more good-loking. Someone advices to organize it with bind/unbind (Bind to service with first and following starts from activity and unbind only when user wants to close messenger) But i think it is not the best solution. What do you think about it? Sep 06 05:48:29 for something like that, you would likely want to use start/stop service, not bind/unbind Sep 06 05:48:57 if you bind to the service from the activity, it will automatically unbind when the activity closes Sep 06 05:49:37 olologin == Ologn ? Sep 06 05:49:58 ah, nm Sep 06 05:54:36 JesusFreke: Ok, when i launch activity again and it tries to start service again (When it already running), i should immediately use something like: Sep 06 05:54:36 if (this.isRunning) return START_NOT_STICKY; Sep 06 05:54:36 ? Sep 06 05:55:16 in onStartCommand ofcourse Sep 06 05:55:44 olologin: only one instance of your service will ever be running. If you try to restart it, it will call onStartCommand on your already running service Sep 06 05:56:26 If you want the service to remain running, you'll want to return START_STICKY Sep 06 05:56:48 yeah, deciding whether to use start/stop, bind/unbind or both overlapping is a big decision Sep 06 05:57:17 gets even more interesting when you consider foreground status, wakelocks ;) Sep 06 05:57:31 bankai_jp rx 0.20.4 Sep 06 05:57:37 oh bankai_jp is in jp now ? Sep 06 05:58:05 So even without this if statement system never creates 2 instances of same service? Sep 06 05:58:20 correct Sep 06 05:58:31 there can never be 2 instances of the same service running simultaneously Sep 06 05:59:36 Hm, but with second startService i see in logcat that system calls onStartCommand again (While previous service instance still runs) Sep 06 06:00:15 maybe it's calling onStartCommand in the same instance Sep 06 06:00:22 Understood Sep 06 06:00:38 you can always Log.d("SERVICE", this) Sep 06 06:00:51 fron onStartCommand Sep 06 06:00:54 from* Sep 06 06:02:08 Problem because i run my tasks in new thread which starts in onStartCommand, so i need to move thread start to onCreate. Sep 06 06:02:51 well there you go then Sep 06 06:03:01 thanks guys Sep 06 06:04:08 no...my other names are like, Onlogn etc. Sep 06 06:04:31 ok... Sep 06 06:04:34 Wherever You Go, There You Are Sep 06 06:04:37 XD Sep 06 06:04:59 yeah, deciding whether to use start/stop, bind/unbind or both overlapping is a big decision <-- not really, I always go for both, seems to provide the most versatility with no visible downsides ;) Sep 06 06:05:30 s/always/the majority of time/ Sep 06 06:05:33 ravilov great, i'll just ask you when i get stuck then :) Sep 06 06:05:42 feel free :p Sep 06 06:06:33 i try not to use bind / unbind ... sometimes you can get away with simply querying a static in the Service Sep 06 06:07:10 i'll usually only use bind / unbind when i need to send commands that don't overlap with service start lifecycle Sep 06 06:07:30 (so long as you'll be asking about services and not getting out of jail after being busted for owning pot or something :p ) Sep 06 06:07:59 nah, i'm handicapped enough - that stuff would be the end of me :) Sep 06 06:08:01 I'm novice in android development, and for me it's not clear why sometimes peoples do all work in onCreate and leave onStart method empty :) Sep 06 06:08:19 usually i only see creation 1 time start stuff in onCreate Sep 06 06:08:32 onStartCommand is when ... you can get multiple commands :) Sep 06 06:08:52 olologin, because the two have a different purpose Sep 06 06:09:07 they are called at different points in the lifecycle Sep 06 06:09:23 I know about lifecycle Sep 06 06:10:23 well then Sep 06 06:12:18 Also about services: In my opinion word "service" means that it always unkillable, but in android, systems kills it every time, even when resources are sufficient, like 300mb ram free. Sep 06 06:12:23 Just saying Sep 06 06:12:49 With foreground feature ofcourse i recieve that behaviour Sep 06 06:13:00 so I have a question now, I have a OnMenuItemClickListener and I want to start an activity when the menu item is clicked, but for that I would need a reference to the activity, can I get that somehow from the MenuItem? Sep 06 06:13:00 but i think it should be that by default Sep 06 06:13:34 olologin, whether the system will kill it or not has not much to do with resources available, rather with the way it's started Sep 06 06:13:54 if it is started and tells the system it is to be permanent, the system will (or should) restart it if it gets killed Sep 06 06:14:55 olologin, there is quite some history behind this, something to do with people abusing services, starting them and leaving them even when unneeded, and thus hogging the entire system/device Sep 06 06:15:12 so I think it might have been the default but people proved to be irresponsible with it so the default got changed Sep 06 06:16:06 ravilov: Yes, maybe it makes sens in that case. Sep 06 06:48:06 yey https://groups.google.com/forum/#!topic/adt-dev/frugpmBwQt0 Sep 06 06:48:16 reported on 12/4/2013 Sep 06 06:48:31 xav says he'll look into it 12/5/2013 Sep 06 06:48:51 people still having problems with it today, in 2014 Sep 06 07:13:34 there is any letter to set double values like long an its ex: 2L Sep 06 07:16:22 what? Sep 06 07:17:37 there's a period Sep 06 07:55:36 I have two switch case stmts. One holds a label1+edittext1 and the other holds label2+edittext2.all those views are written programatically. And my xml file only holds LinearLayout,orientation=vertical. How can I make them to appear as label1 edittext1 and next line label2 edittext2 through code not xml? Sep 06 07:56:46 layout.setOrientation(LinearLayout.HORIZONTAL) makes all the views to come in one line Sep 06 07:57:05 I want them in two different lines Sep 06 07:59:56 I think I should be having two LinearLayouts calling one at a time as required Sep 06 08:02:18 Or a GridLayout Sep 06 08:02:26 if you want them aligned Sep 06 08:23:07 <_flip> what's the best way of handling a global state in an android app? Say for something like a LoggedIn state? Sep 06 08:27:16 A static class with setters and getters? Sep 06 08:28:19 _flip: create a class that extends Application and set it in the tag in the manifest and just like an use the android:name attribute. Sep 06 08:28:56 _flip: then you can put your state in there Sep 06 08:29:25 _flip: at any time you have a context call context.getApplicationContext() and cast it to your custom extended class Sep 06 08:31:02 <_flip> thanks Napalm|vacation Sep 06 08:31:05 np Sep 06 08:36:07 <_flip> also thanks eckesicle, that would be the standard way of doing it. I was just wondering if there was a more "android" way of doing things. Sep 06 08:36:43 <_flip> still trying to wrap my head around how android works with the contexts, activities and intents etc. Sep 06 08:42:54 I would not extend the Application class Sep 06 08:43:41 using the Application class is really only necessary if you want to handle broadcasts in it Sep 06 08:44:18 I would start with a static singleton and only if you need it transition to an Application-derived class. Sep 06 08:58:04 eckesicle: whats the downside in extending application class vs singelton in your opinion? :) Sep 06 09:32:50 why google suggest to create static class for ViewHolder if later suggest to allocate a new object? Or static or a new() call. Sep 06 09:36:17 new static Sep 06 09:38:11 what do u mean with new static? Sep 06 09:38:28 there are no static classes in java Sep 06 09:38:33 well at least in way you think Sep 06 09:38:49 you can have internal static class or external normal class Sep 06 09:39:13 the point is that class doesnt have direct access to outer class method Sep 06 09:39:25 as the normal internal class would Sep 06 09:39:51 so you instantiate "static" classes as normal Sep 06 09:40:52 ok. thanks @Ashiren Sep 06 10:01:20 I would have sworn there was a fuzzy date formatter somewhere in Android / support libs Sep 06 10:01:27 anyone remember any lib for that? Sep 06 10:01:43 e.g. "3 minutes ago" formatter Sep 06 10:04:42 Mavrik if there is can you let me know, I never thought to look and did some rather untidy switch stuff :( Sep 06 10:04:49 Mavrik: android.text.format.DateUtils? Sep 06 10:05:58 that has outputs like "3 mins ago" or "yesterday" Sep 06 10:06:24 with DateUtils.getRelativeDateTimeString() Sep 06 10:07:52 danijoo wicked... Sep 06 10:07:53 :) Sep 06 10:08:51 Hey, I need to make a child View of a ListView not display the being-clicked-on animation when it's clicked. How do I do that? setEnabled makes it be greyed out, which I also want, but it still flashes blue when clicked. Sep 06 10:09:09 ah, DateUtils yes Sep 06 10:09:17 but... of course... no Locale parameter Sep 06 10:09:19 so f00. Sep 06 10:09:38 threenuc: a static background instead of a selector Sep 06 10:09:47 or make it not clickable Sep 06 10:09:50 and we still don't have a reliable way to override app locale it seems Sep 06 10:10:04 Mavrik: yeah thats one thing that bothers me too.. Sep 06 10:10:54 danijoo: How do I change a view to static programatically? I tried setClickable (or something like that). It was still clickable :| Sep 06 10:10:57 It's just annoying as hell, since there's bunch of people here that don't have phones which support local language Sep 06 10:11:00 but the app is in local language Sep 06 10:11:12 so you get half translated crap :/ Sep 06 10:11:44 threenuc : what do you mean by setting a view "static"? Sep 06 10:11:48 also there are users that might want one app in another language.. Sep 06 10:11:53 rgr: he means not clickable. Sep 06 10:11:57 ah Sep 06 10:12:14 and as I said, just remove the selector Sep 06 10:12:22 sound right :) Sep 06 10:12:33 setEnabeled(false) should do the trick too i think Sep 06 10:13:11 if thats what he really meany by "static". Does he want it to "grey out" too? Or he could just replace the listener to do nothing. Sep 06 10:13:42 12:08 threenuc: Hey, I need to make a child View of a ListView not display the being-clicked-on animation when it's clicked. How do I do that? setEnabled makes it be greyed out, which I also want, but it still flashes blue when clicked. Sep 06 10:13:46 or rather set a member on the wrapepr class which tells the listener to do nothing and ignore the click. Sep 06 10:15:42 I need it to become greyed out (which setEnabled does just fine), then I need to make it so it doesn't display the click animation (the view flashing blue) when clicked. When clicked it displays a toast. Sep 06 10:20:11 blah yeah, that DateUtils isn't localizable at all Sep 06 10:20:53 Does ListView have a separate selector style for disabled elements? Sep 06 10:21:25 Mavrik: maybe you can override some method to to not use Locale.getDefault? Sep 06 10:21:39 nah, it doesn't work :/ Sep 06 10:21:43 due to this: http://stackoverflow.com/questions/6539195/force-android-dateutils-getrelativedatetimestring-to-ignore-the-device-locale Sep 06 10:21:46 I guess manually it is. Sep 06 10:23:01 i see Sep 06 10:23:22 would have been to easy to have a setLocale method... Sep 06 10:26:17 yes, that would make Android development boring or somethin :P Sep 06 10:39:19 In android studio, i got this "Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V" when i tried to use the xml gui editor(drag and drop widgets one). How do i fix this? Sep 06 10:54:00 Does will be google fit API only for android L? Sep 06 10:56:41 HI Sep 06 11:46:26 SohamG: you dont. Its a bug. It will be fixed. Report the bug if its not already registered. Sep 06 11:54:40 rgr : A temporary solution is to set the API level there to 19 with verison 4.4.2.... Sep 06 11:56:29 Temporary solution is to not use AS until its out of beta :p Sep 06 11:57:36 Also, don't use drag and drop to build UX Sep 06 11:58:19 AS/Intellij are incredibly stable considering its "beta". Well IJ is. The only niggle is device dependant layouts. I have to tickle it all the time to get the build to pick up the new layouts. Sep 06 12:01:25 hi there guys, is there any way to make an adb server temporally unkillable? Sep 06 12:01:48 and on that subject it wont pick up the new smaller size layout!!!! aargh....its continuing to use an older now gone version. bah. Sep 06 12:03:20 android dev dev Sep 06 12:03:23 bam bam bam Sep 06 12:06:48 A menu in my action bar won't inflate... I have overridden onCreateOptionsMenu() and onOptionsItemSelected() in the activity... I have a debug message that prints in onOptionsItemSelected() so I know it's being called when I click the button... I just don't understand why the menu doesn't pop up. Am I doing something wrong? Here's the activity source: http://pastebin.com/Ma3NisRN Sep 06 12:09:40 HearWa: menu item not visible at all or just dont react to clicks? Sep 06 12:10:50 The menu isn't displaying. When I click the button I see my debug message in logcat. Would it help if I gave you the menu xml as well? Sep 06 12:10:58 you call the super onOptionsSelected first. Sep 06 12:11:05 ignore Sep 06 12:11:25 yes that would hep Sep 06 12:12:15 menu xml: http://pastebin.com/zpw9QMsc Sep 06 12:12:16 HearWa: your problem is your calling super in onOptionsItemSelected. You shouldnt you return false to say "you process" it afaik Sep 06 12:12:51 so "return false" and not return super.onOptionItem...() Sep 06 12:13:02 C-q on the function name. Sep 06 12:13:05 (javadoc) Sep 06 12:13:26 rgr: what are you talking Sep 06 12:13:33 he says the menu doesnt show up at all Sep 06 12:13:44 what as optionsitemselected to do with that Sep 06 12:14:10 thats another issue. Im just pointing out the onOptionsItemSelected is wrong too. Sep 06 12:14:59 HearWa: maybe your menu got pushed into the overflow menu because you dont have enough room? Sep 06 12:15:04 I've tried various combinations where I just return true, return false, nothing works Sep 06 12:15:07 doo you see 3 dots in the menu? Sep 06 12:15:31 also hes calling super.onCreateOptionsMenu(menu) at the end and not at the start before he inflates. MAYBE thats an issue too. Not sure. Sep 06 12:15:37 I see the menu items, when I click on them I don't see the menu, but onOptionsItemSelected() is being called Sep 06 12:15:59 you dont see what menu? Sep 06 12:16:06 rgr: that doesnt matter. the order only determines the order of the menu items from superclass to child (first inflated, shown on the left) Sep 06 12:16:07 Nope, I see the resource images I defined for the xml elements Sep 06 12:16:19 danijoo_: ah ok. Sep 06 12:16:30 so you are actually seeing it when you see the images.. Sep 06 12:16:46 Im not sure what he can and cant see anymore :) Sep 06 12:16:55 same here ^^' Sep 06 12:16:57 I'm developing on a note 3 so I have lots of retail space on the screen. This is just an example I'm trying to get working. Sep 06 12:17:12 HearWa: explain again. You do or you do NOT see your own menu? Sep 06 12:17:22 I see the images in the action bar. When I click on them I am expecting to see a menu. I am not seeing that menu. Sep 06 12:17:23 HearWa: so to clear this up. you are seeing all the icons, but what you want is seeing the text? Sep 06 12:17:33 Drop down menu... Sep 06 12:17:41 you have no drop down menu in the xml Sep 06 12:17:45 why are you edpecting to see a menu. You told us nothing about that. there is no drop down. Sep 06 12:17:50 soo.. how should you see one? Sep 06 12:17:56 +1 :) Sep 06 12:18:32 That's odd, why does my preview window show a menu then? Sep 06 12:18:47 because preview never looks like it should Sep 06 12:18:48 :) Sep 06 12:19:08 what you are doing in your xml is just throwing all the 6 items into the actionbar Sep 06 12:19:09 :( Sep 06 12:19:13 and thats what you are seing Sep 06 12:19:24 Sorry guys new to this Sep 06 12:19:34 Ahh. Sep 06 12:20:07 Well then, I feel silly. So question then... how would I go about displaying a menu if I click on those? Sep 06 12:20:26 HearWa: use the debugger too. Step through. No need to add log messages. Set a breakpoint. No code to change. Less risk of breaking things. Have fun. Sep 06 12:21:38 Will do. Sep 06 12:22:18 HearWa: for a drop down menu, you must wrap two menus together Sep 06 12:22:21 like this: http://pastebin.com/9x1chC2W Sep 06 12:22:48 you ahve an outer menu (which will be the actionbar), and there is an item, which wraps the menu that item should show on click Sep 06 12:23:15 ignore the bad intendation in the file :p Sep 06 12:25:27 danijoo_: Thank you! That worked. Sep 06 12:25:53 yw Sep 06 12:26:15 I guess I was expecting the previous window to behave like the visual studio designer with the presentation. Sep 06 12:26:22 preview* Sep 06 12:27:22 I dnot get why you would think that. There is clearly no sub menu in your code. Sep 06 12:30:40 rgr: thing is that the AS/Intellij preview seems to show aeverything like it is in the overflow menu Sep 06 12:30:50 that might confuse users without experience Sep 06 12:31:48 Yeah that's what it was. I should have paid more attention to the xml layout though... Sep 06 12:32:04 sure. I must admit I rarely use the preview now : only to check what attrs are available. Sep 06 12:32:10 hey everyone Sep 06 12:32:17 android beginner here Sep 06 12:32:42 how do i use restful apis in my app? Sep 06 12:33:05 theres that site Sep 06 12:33:14 where you can enter a question Sep 06 12:33:41 but whats really p*ssed me off is this : I have a layout for a nexus 4 and one for the 7. I have just spent the bones of half an hour wondering why the N4 layout wasnt showing on the N4. I invalidated caches . I restarted, I gradle cleaned. You rewrote the layout file. I rebuilt. I deleted the app from the phone first etc etc. Nothing worked. In the end I copied the Nexus7 layout file over the top of the N4 one and "tada" it FINALLY Sep 06 12:33:42 picks up the device specific layout. Very poor. Sep 06 12:33:43 and get answers. im pretty sure its in the first 10 results :) Sep 06 12:33:56 danijoo_: I tried but Sep 06 12:34:05 everything is very confusing Sep 06 12:34:28 ashemark: yes. You need to read the docs and do some work. There are oodles of tutorials with examples in google. Sep 06 12:34:38 The ask specific Qs here. Sep 06 12:34:54 rgr: sure, i read the api docs Sep 06 12:35:04 but where to get started with android Sep 06 12:35:05 android restful api give me 3 tutorials on first page Sep 06 12:35:08 API docs are for looking things up. Sep 06 12:35:17 read tutorials and StackOverflow examples. Sep 06 12:35:50 if you want it really easy use http://square.github.io/retrofit/ Sep 06 12:36:16 danijoo_: thanks a lot Sep 06 12:36:31 can you explain a couple of theoretical questions I have? Sep 06 12:36:41 maybe Sep 06 12:36:47 Like there are RESTful apis and there are some called SOAP Sep 06 12:36:50 ashemark: seriously, there are oodles of examples and free code. http://lmgtfy.com/?q=android+restful+example Sep 06 12:37:13 rgr: gotcha Sep 06 12:37:25 but just need some meta knowledge here Sep 06 12:37:27 ashemark: thats not on topic. Thats your own research. https://duckduckgo.com/?q=rest+vs+soap&t=debian Sep 06 12:37:57 rgr: sure Sep 06 12:37:59 its all in the google foo ;) Sep 06 12:38:05 :D Sep 06 12:38:37 thanks Sep 06 12:39:51 guys, I have a request. Could someone point me to a tutorial or something where I can learn to make a webservice or whatever to access online databases and stuff from an android device? I coudn't find anything android specific :( Sep 06 12:40:34 lol Sep 06 12:42:00 I need a Service running the background. It will make a notification and broadcast an intent with data. The notification has a pending intent that starts an Activity. If the Activity was already running, it will also receive the broadcast intent. Anyway! I basically want to start the service and forget about it. But for good measure, I'd also like to be able to stop it. Sep 06 12:42:59 luci1093: can you be a little more precise : whats a "web service or whatever"? Sep 06 12:43:35 I have two fragments - a grid view and a list view Sep 06 12:43:44 Certainly android talking to a database is well covered : often just through async rest calls Sep 06 12:43:46 I want to now make a nice widget that lets you switch between the fragments Sep 06 12:43:48 well, to be more precise I don't know how am I supposed to access a database stored on a server on the internet ... Sep 06 12:43:58 should I make another fragment that I put these two fragments in? Sep 06 12:44:01 Should I simply extend IntentService and add my stuff in onHandleIntent(), run startService() and eventually stopService()? If I understand it correctly, onHandleIntent() runs inits own thread, so this is nice. But how does stopping it work? Do I need my own boolean to check if I should break out and return onHandleIntent()? Sep 06 12:44:04 or should I make a view or something? Sep 06 12:44:32 its a big topic. You should probably read up on what a server is and how clients connect to an rdbms. The the android bit will come into Q... Sep 06 12:44:46 but async rest is one such way. Sep 06 12:44:59 What's the difference between a fragment and a view? When should I use one or other? Sep 06 12:45:42 luci1093: It doesn't usually work that way, unless it's your own database. For example you can open up a mysql port to the Internet, but that's ill-advised... most of the time if you need to communicate with a database you will be doing it though an API that has been made available... be it restful, soap, or something they scraped together... barring that you can write a web-scraper Sep 06 12:46:26 well yes... my problem is how exactly do I do that API to access the database :| Sep 06 12:46:55 Well that depends on what you need to connect to, and what they allow you to do, so specifics are needed Sep 06 12:47:09 For instance twitter and facebook both have an API Sep 06 12:48:23 well I pretty much need the general knowledge to making those APIs ... Sep 06 12:48:51 of course where there is an API already I'm going to use it... but what if I need to make one? :S Sep 06 12:48:58 You don't make them, you use them, if you are connecting to someone elses database as it seems Sep 06 12:49:03 JohnFlux: it can be tricky and often device dependent views are enough. A fragment allows you better ability to structure your app - tablet or not. The fragments are then accessed from the activity. Fragments should never inter communicate IMO : always back through the "mother" activity. That way you can plug functionality in and out depending on need, screen dimensions or whatever. I recently converted my first app to fragments and it Sep 06 12:49:03 just makes for a better structure too IMO. The fragments are then in charge of inflating their own views. I really recommend this book - a pdf can be found (no idea how legal) : http://www.amazon.com/Creating-Dynamic-UI-Android-Fragments/dp/1783283092 Sep 06 12:49:23 I'm an android noob but you should look into soap and restful interfaces. Sep 06 12:50:41 rgr: is that different from a view though? Sep 06 12:55:30 hello, anyone developed an app that "uses" stk? Sep 06 12:55:58 you really need to try it. Have a couple of different views then convert to frags and see. Its very hard to explain. Im noob enough not to be able too : but youre not alone. A brief google through stackoverflow shows many people saying "use fragments" with no realy reasn why. That book nails it IMO. Sep 06 12:57:08 Most you can emulate with views I agree. And the fragment gives you direct access to the Activity too which may sound minor but its quite nice ;) Sep 06 12:59:07 The first answer here addresses your Q : http://stackoverflow.com/questions/9827072/why-use-fragments Sep 06 13:29:42 rgr: is it fine to have fragments inside of fragments? Sep 06 13:32:35 Its just a "thing" like anything else. I havent done so but I see no reason why not. A brief google says YES you can in android 4.2.2 onwards. Sep 06 13:32:46 http://stackoverflow.com/questions/6847460/fragments-within-fragments Sep 06 13:32:53 4.2 Sep 06 13:35:26 just make sure to use the support-v4 Fragments Sep 06 13:35:30 or you'll have hell on earth. Sep 06 13:41:54 <_flip> So I have a MainActivity, this gets started when i launch my app. In MainActivity.onCreate() I check isUserLoggedIn = false then StartActivity(LoginActivity) Sep 06 13:42:07 <_flip> this sort of works, but I have problems with the back button functionality Sep 06 13:42:31 <_flip> what would be the recommended way of dealing with this? Sep 06 13:44:21 <_flip> I suppose the problem is that i don't destroy the MainActivity and so when i press the back button MainActivity.onCreate isn't called Sep 06 13:44:53 <_flip> would the best way be to simply override onBackPressed in the LoginActivity and have that terminate the app? Sep 06 13:45:14 <_flip> it still seems a bit crude... Sep 06 13:46:11 _flip, just finish() the main activity Sep 06 13:46:18 right after you call startActivity Sep 06 13:46:26 and it'll be removed from backstack giving you behaviour you want Sep 06 13:47:06 <_flip> is that recommended? right after successful login i go straight back to MainActivity Sep 06 13:48:52 why wouldn't it be recommended? Sep 06 13:49:25 you'll most likely have to refresh at least some state depending on login in the MainActivity, which makes your code significantly simpler Sep 06 13:50:40 <_flip> right, thanks. Sep 06 13:51:19 I have two fragments. Each fragment has an AsyncTask in them and use two different interfaces so the AsyncTask can send results back to the fragment. The AsyncTask is called in the onCreateView...the AsyncTask executes, but it also executes the AsyncTask in my other fragment which has not been created. How is this possible? Sep 06 13:52:24 when one asynctask in one fragment is executed, it executes the other one as well, in the other fragment Sep 06 13:52:38 and the other fragment hasn't even been created yet Sep 06 13:53:19 O.o Sep 06 13:53:31 sounds like you would get alot of complexity fixed if you'd use a message bus library :) Sep 06 13:55:35 Why are the two asynctasks being executed one after another the activity doesn't even create the second fragment which holds the other asynctask? Sep 06 13:55:56 because you execute it Sep 06 13:56:22 it would be wierd if it wouldnt - you said so yourself, you execute the second asynctask when the first completes Sep 06 13:56:32 how? The fragment that executes the second asynctask is NOT created when the first fragment executes its asynctask Sep 06 13:56:40 no i didnt Sep 06 13:56:48 pastebin the code of the first async task. Sep 06 13:56:56 ok hold on Sep 06 13:57:51 http://pastebin.com/RdYyf8YN Sep 06 13:58:25 em, there's something missing Sep 06 13:58:39 Fragment A is drawn on the Activity... ^^ that asynctask executes..then for some reason Fragment B's asynctask executes as well Sep 06 13:59:58 MartialLaw, it doesn't look like you pasted the full asynctask code. Sep 06 14:00:06 where's the onPostExecute_ Sep 06 14:00:07 ? Sep 06 14:00:41 oh sorry Sep 06 14:01:27 http://pastebin.com/F1Gd8zr6 Sep 06 14:02:58 hmm Sep 06 14:03:30 well the only real explanation is that your JSONCallback is somehow triggering the second async task in the callback Sep 06 14:03:49 yeah I figured that but there is nothing in my code that would do that Sep 06 14:03:51 calling a class inside a fragment isn't really connected to that fragment actually being attached anywhere or even existing :) Sep 06 14:03:57 hmm Sep 06 14:04:34 I don't think it really even matters. So long as each fragment gets the data they need Sep 06 14:06:00 Maybe show us the code of the Other fragment as well as the code that triggers the other fragment. Sep 06 14:10:04 code which executes the asynctask is static? Besides fragments shouldnt communicate for this very reason. The parent activity should marshall the comms between them preferably by implementing interfaces defined by the fragments themselves. Sep 06 14:12:42 Hi everyone. I have a very strange "bug" in my listview. Someone could help me please? http://goo.gl/Xi1C49 Sep 06 14:13:44 I think it's the famous viewHolder pattern. It's very strange that some row are reused for wrinting on some other "row" data Sep 06 14:14:14 But I don't know where could I do an error with so simple code Sep 06 14:24:59 I think it's an error of implementing viewholder pattern. But it seem that I'm doing the same as many tutorials online. Sep 06 14:33:05 how can I change the fragment UI outside of the oncreateview method? Sep 06 14:34:57 The listview try to fill the screen with row and so adds other row recycling the first item of the list. is it possible? Sep 06 14:37:07 Error:(69, 115) error: inconvertible types required: ListAndGridSwitcherFragment found: Fragment Sep 06 14:37:21 I get this error, but ListAndGridSwitcherFragment extends Fragment Sep 06 14:37:31 my code is: mListAndGridSwitcherFragment = (ListAndGridSwitcherFragment) getSupportFragmentManager().findFragmentByTag("listAndGridSwitcherFragment"); Sep 06 14:37:54 I can't think what I could be doing wrong. Sep 06 14:38:33 MartialLaw: change how? Sep 06 14:49:30 I delete the viewholder pattern and now works fine. I don't know why: http://goo.gl/ze9UZy Sep 06 14:51:59 u did the view holder wrong :P Sep 06 14:53:11 what am I doing wrong? Sep 06 14:53:38 ahahha yes I understood :D Sep 06 14:54:03 :) Sep 06 14:54:14 yes I think it's that :) probably :D Sep 06 14:54:43 But the best way is that it's the same of multiple tutorial I saw online. mah Sep 06 15:01:28 do we have a gradle task that purges all the pointless Play Services assets from the APK when releasing? Sep 06 15:03:02 I started two new thread (T1, T2) from main thread. What is the best way to communicate between this two thread? If something happened in T1 then T2 have to do something. Sep 06 15:13:03 @slani Pattern OBSERVER Sep 06 15:13:07 ? Sep 06 15:25:16 the different states or so confusing Sep 06 15:25:26 can someone help me with this problem http://pastie.org/9532043 ? Sep 06 15:32:15 shmoon_: is it staying purple? Sep 06 15:32:28 oops read the bottom :) Sep 06 15:32:33 shmoon_: I don't know at all, but are items in a grid view selected by default when you press them? Sep 06 15:32:52 shmoon_: don't you need to add some code to the grid view to select the item on click or something? Sep 06 15:33:09 shmoon: you should add a non pressed/selected state after your pressed state, and maybe make seperate selected/pressed Sep 06 15:33:21 shmoon_: android:state_selected="true" android:state_activated="true" android:state_pressed="true" Sep 06 15:33:31 is this "anded" or or'd? Sep 06 15:33:39 might you need three lines for this? Sep 06 15:36:31 JohnFlux: good points Sep 06 15:36:34 I've added this gridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE); Sep 06 15:36:50 let me try with JUST pressed, and remove others. i thought it might be OR'd but might get AND'ed never know Sep 06 15:36:58 shmoon_: I would add in debug code to set an item to selected state Sep 06 15:37:04 shmoon_: the first item, say Sep 06 15:37:34 so on longitemclicklistener I'm doing view.setSelected(true) and view.setActivated(true) Sep 06 15:39:01 alright, if i have ONLY state_pressed=true that works fine, it becomes purple Sep 06 15:39:16 if i have only state_activated="true" nothing happens (which is what i wanted to work with Sep 06 15:40:44 ok here's an updated pastie with the listener code http://pastie.org/9532082 Sep 06 15:50:16 shmoon_: do you have drawSelectorOnTop=true? Sep 06 15:50:33 if you background is opaque Sep 06 15:59:27 nope let me try that too canvs2321 Sep 06 16:00:31 these states are really confusing, i wish there was a page that explained all of them in different contexts with screenshots/videos Sep 06 16:04:21 canvs2321: nah no luck Sep 06 16:31:30 Hi, after binding busybox "mount -o loop,noatime $kit/debian.img $mnt" and chrooting, and then existing, is it necssary to "release" the loop using something like busybox losetup -d /dev/loop0 (or another number)? Sep 06 16:32:19 does it consume more energy to leave the image bound to a dev loop? Sep 06 16:38:20 francogrex, this has nothing to do with android Sep 06 16:38:40 but no, as far as I know auto-assigned loop devices get detached on unmount Sep 06 16:39:44 ravilov: chrooting from android Sep 06 16:40:22 using android term emulator Sep 06 16:48:26 anyone here? there is any way to update a fragment based on activity changes Sep 06 16:49:29 Where there is a will there is a way Sep 06 16:53:06 cliffreich: what do you mean? Activities talk to fragments and the fragments update all the time. Its why they are there. Sep 06 16:53:52 Hello guys Sep 06 16:56:07 I forked an android lib on github and made a few changes. then I added it as a dependency gradle dependency by adding: compile 'com.github.foo:bar:+' Sep 06 16:56:33 when I sync the project Studio says it failed to find the lib Sep 06 16:57:03 do I have to register it anywhere or gradle is supposed to take it from my github account? Sep 06 17:05:14 i think it should be in your app folder Sep 06 17:05:22 like a libs directory Sep 06 17:06:16 and using compile project(':libs:foldername') Sep 06 17:06:28 google for better answer Sep 06 17:06:56 or you can publish it to your local maven .m2 repo and then include it using a maven token. Sep 06 17:12:51 I thought gradle was taking it from github, the original dependency is: compile 'com.github.satyan:sugar:1.3' Sep 06 17:13:44 dunno. Thought you forked it locally and built it. If you can build from git great. Sep 06 17:16:49 Anyone interested in building an app with myself and a couple other people? We aren't experts, just doing something that is an interesting idea, and for us to learn a bit more. Every project helps you, right. PM me if interested Sep 06 17:18:05 lol Sep 06 17:19:47 Anyone know what "full-bleed" images are in the context of android layout? Google dont help. This fella uses the term in a tutorial on layout aliasing : http://www.pushing-pixels.org/2012/12/05/android-layout-aliasing.html Sep 06 17:22:48 rgr I think they refer to both the image and cell layout Sep 06 17:23:26 I think that they mean when something it active, it expands to reveal more of what was there Sep 06 17:23:52 hence what is there has to be cropped/restricted in some way till exposed/active Sep 06 17:23:59 or that would be my take on it Sep 06 17:24:07 just and opinion neways Sep 06 17:38:35 how do i update a fragments layout after activity changes? Sep 06 18:04:29 Same as you change any layout programmatically if thats what you mean. Give some details. Sep 06 18:18:47 rgr Sep 06 18:19:49 Can I make as fragment transaction in onStop? or maybe in onResume? I want my level to restart after a phone call is received. it does not work to continue with the level Sep 06 18:19:57 im using a locationlistener on my main activity. so i handle all location stuff in there. also, i added an actionbar so it load fragments, but the fragment content is dynamically added based on location Sep 06 18:20:42 you can inflate or kill stuff on demand Sep 06 18:21:07 then i need something to update the fragment when the main activity onlocationchange changes Sep 06 18:21:43 or should i destroy the fragment and re attach it? Sep 06 18:23:19 if i use an interface, this would be auto triggered if called by onlocationchange? Sep 06 18:37:45 cliffreich: what? Sep 06 18:38:57 mainactivity handles location, and fragment needs location as content is dynamic Sep 06 18:39:19 how to mainactivity -> refresh fragment Sep 06 18:39:31 based on location changes Sep 06 18:39:44 with fragment manager? Sep 06 18:42:45 ill back in some minutes to try that, i had an issue with it but right now have to leave Sep 06 18:43:18 if i had to buy 1 android device to do development.... what would you buy? Sep 06 18:43:40 I'm targeting api19 but android studio doesn't want to show android's javadocs in tooltips even with the L Preview docs downloaded. Is there a way I can get it to? Sep 06 18:43:42 (i hope it s not too broad of a question) Sep 06 18:43:47 DrGonzo: a Nexus device. Sep 06 18:44:01 DrGonzo: Get a used galaxy nexus or nexus 4 on ebay for cheap Sep 06 18:44:02 k Sep 06 18:44:20 not better to go with what's latest? Sep 06 18:44:43 sure, if you can afford it. but you can root the device and install the latest OS on it, even if it's not officially supported anymore Sep 06 18:45:25 my testing galaxy nexus is not rooted and it's on android 4.3 Sep 06 18:59:08 for reference, my quick documentation just looks like this: http://i.imgur.com/oPkDyb8.png Sep 06 18:59:13 it's very annoying. Sep 06 19:01:34 actionBar.setTitle( R.string.app_name ); is that always safe or should I getResources and parse? Sep 06 19:08:45 Can I just not use the quick documentation unless I'm targeting android L? That seems pretty shitty given that it's an unfinished api anyway Sep 06 19:08:51 I want to target the latest stable version Sep 06 19:17:57 in strings.xml, can I make a string out of other strings...? Sep 06 19:22:48 anyone use office 2010 here? Sep 06 19:23:08 smitzer: what you mean? Sep 06 19:23:46 hello all Sep 06 19:25:04 can someone help me change the color of the menu text? http://i.imgur.com/GwZuxxx.png Sep 06 19:25:40 gdrc: I have an about string so I would like it to autoupdate if I change app_version or app_name for that matter (game is not released yet) Sep 06 19:25:57 ofc I could do it in code Sep 06 19:26:31 "App version: " + R.string.app_version + "Developer: " + ... Sep 06 19:26:36 can I do that in xml? Sep 06 19:27:01 you can autogenerate with gradle. Sep 06 19:28:22 dont know gradle really (even though i use Android studio) Sep 06 19:31:07 smitzer: does the string need to be in resources? Sep 06 19:34:59 gdrc: well it was just neater that way. ican ofc do it in code Sep 06 19:35:06 Guys, i create notification for foreground service, but later another notification (From new recieved message of the same app) overwrites it. What can i do to prevent this? Sep 06 19:35:12 i was just wondering if it was possible Sep 06 19:35:59 smitzer: sorry I know you only do it with gradle Sep 06 19:36:48 hey people Sep 06 19:41:15 if I restart a fragment from its own onPause method, will something go very wrong? seems unsafe and illogical. Sep 06 19:41:37 I want my fragment to be restarted when it is paused and then resumed. what is the best way to do this? Sep 06 19:43:31 Napalm|vacation: hey. where are you ? Sep 06 19:44:01 and... what the hell are you doing here if you are on vacation? Sep 06 19:44:31 i am attempting to code in a different climate to determine if this will be a suitable location for a future venture Sep 06 19:44:45 plus coding is fun Sep 06 19:45:05 can someone help me change the color of the menu text? http://i.imgur.com/GwZuxxx.png Sep 06 19:46:06 gdrc: oh btw, Ibiza Sep 06 19:46:32 wow, nice discos and girls Sep 06 19:47:02 got a villa and boat to myself and a few mates Sep 06 19:47:30 you're rich man Sep 06 19:48:55 its rented Sep 06 19:49:06 10 days for both Sep 06 19:49:17 skydoge: thats your theme Sep 06 19:49:39 theres a theme attribute for it.. i forget what it is though Sep 06 19:49:44 yeah... Sep 06 19:50:56 anyone have an idea for the attribute? Sep 06 19:51:49 Napalm|vacation, how's your vacation being? Sep 06 19:52:14 In Ibiza, not bad. Sep 06 19:54:59 yeah android:actionmenutextcolor isnt it... Sep 06 19:55:58 nvm got it at android:textColor because im stupid and its my second day in android studio Sep 06 20:00:09 Can someone answer to my question pls ^_^ Sep 06 20:07:38 olologin have you searched google ? Sep 06 20:08:01 https://duckduckgo.com/?q=Android+don%27t+overwrite+existing+notification&t=canonical Sep 06 20:08:32 duck duck go Sep 06 20:08:34 wat Sep 06 20:08:35 Can't find anything except 1 question from stackoverflow Sep 06 20:09:25 setID() Sep 06 20:09:54 hello everybody Sep 06 20:11:14 google don't works from my ip, lol Sep 06 20:11:29 does the inputtype = "phone" constrain the edittext to only accept 10 digit phone numbers? Sep 06 20:13:01 olologin as in ID, make it different Sep 06 20:14:36 StingRay_: I know about id already, but can i change id of foreground service notification? Because message id's numerated from 0 to n, and i want for example -1 for foreground service Sep 06 20:18:39 Are you really against splash screen if it is only on install? 1 splash screen when you install and then never again. My install takes 5 seconds, i am afraid of an ANR... Sep 06 20:18:52 hmm, looks like understood Sep 06 20:19:05 why does your install take 5 seconds Sep 06 20:23:44 smitzer what has a splash screen got to do with ANR ? Sep 06 20:27:32 StingRay_, I have to run on background thread and then I have to show something... Sep 06 20:28:04 or not install but first time app is started Sep 06 20:28:20 smitzer still not sure what a splash screen has to do with ANR Sep 06 20:31:04 Instead of doing stuff on main thread I do it on bg thread. I cant let user proceed in GUI so I show splash screen until install is finished and then i show the gui Sep 06 20:31:09 what is unclear? Sep 06 20:31:22 what is taking so long Sep 06 20:31:49 in your background thread Sep 06 20:34:38 smitzer nothing, just still a splash has nothing to do with ANR, your splash screen is by design Sep 06 20:34:49 achieved the same as if disabling buttons etc Sep 06 20:35:06 or showing a non-cancellable progress dialog Sep 06 20:35:41 Seriously, does anyone know how to fix this? http://i.imgur.com/oPkDyb8.png Sep 06 20:35:46 StingRay_, yes that is what I mean by splash screen, just a progress bar Sep 06 20:36:03 I can't be learning new APIs by googleing every new method as it comes up. It's extremely annoying Sep 06 20:36:42 im interested smitzer in what takes 5 seconds on a bg thread Sep 06 20:37:00 I've downloaded the api19 docs and put them in my /sdk/docs/ folder and AS still refuses to recognize them Sep 06 20:38:18 I assume there's freelancers here: how do you usually get hired? Sep 06 20:38:21 Personal website? Sep 06 20:38:45 desmin88, dont know what it takes on a bg thread but when my app is run the first time it inits the database and that takes 5 seconds Sep 06 20:39:00 you could probably fix that Sep 06 20:39:04 maybe i dont need a progress bar, just run it on bg thread Sep 06 20:39:15 and disable buttons until it is finished Sep 06 20:39:41 it takes 5 seconds to initialize a database Sep 06 20:39:43 what are you doing to it? Sep 06 20:43:24 desmin88, inserting 45 rows only. without it it takes 2-3 seconds less Sep 06 20:43:46 i added so i do it in 1 transaction to Sep 06 20:44:02 i am not doing anything stupid like closing ansd opening it for every insert Sep 06 20:44:19 insert 45 rows of what kind of data? Sep 06 20:44:38 smitzer thats just busted, you should be able to insert 3-4K records in 2-3 seconds ;) Sep 06 20:44:55 unless you're storing some huge blobs or something Sep 06 20:44:58 * desmin88 agrees with g00s Sep 06 20:45:42 ill post code Sep 06 20:45:51 i also think it is weird Sep 06 20:46:12 * JavaDog needs help. please help him... Sep 06 20:46:45 try this Sep 06 20:46:46 http://stackoverflow.com/questions/17912527/how-to-open-android-documentation-and-samples-of-code-in-android-studio Sep 06 20:47:33 desmin88: There's no "documentation paths" tab anywhere Sep 06 20:50:36 http://i.imgur.com/ckuUUBj.png Sep 06 20:52:36 http://pastebin.com/eAztp1Fs <- paste Sep 06 20:53:15 check public void initializeHighscores2() Sep 06 20:58:14 desmin88: It seems that I'm missing that whole "Android SDK" tab. what the hell. Sep 06 20:59:55 JavaDog, I think have to install the docs for Android SDK separately via the SDK manager tool Sep 06 21:00:41 they've been installed. I installed the android L docs, didn't work, and I manually downloaded the api19 docs which also don't work, but SDK manager can tell that they're installed Sep 06 21:03:29 desmin88, g00s , gdrc ^ Sep 06 21:04:13 http://i.imgur.com/GwIv9XQ.png Sep 06 21:04:46 wat? Sep 06 21:05:08 gdrc, my codez Sep 06 21:05:15 http://pastebin.com/eAztp1Fs <- paste Sep 06 21:05:18 check public void initializeHighscores2() Sep 06 21:05:39 use greendao Sep 06 21:05:42 you save time Sep 06 21:05:52 thats what is called the first time app is run and it adds 2-3 seconds to the time it takes until the app is loaded Sep 06 21:05:53 greendao? Sep 06 21:06:25 I've drunk too much beer to follow the code Sep 06 21:07:27 $2 via google wallet to whomever can solve my quick docs problem :| Sep 06 21:08:05 $2? we're not chineeses or indians Sep 06 21:08:12 some of you might be Sep 06 21:08:22 and I'm poor. this is the last $2 in my checking account, so take it and be happy Sep 06 21:08:35 they are working Sep 06 21:08:51 it's half a beer lol Sep 06 21:10:28 g00s, desmin88 , any input? Sep 06 21:10:48 Anyone interested in working ona project with me? Sep 06 21:14:24 BEGINNER Sep 06 21:14:44 Wow. I fixed it. Sep 06 21:15:36 If anyone else ever has this problem: change your "/sdk" folder to another name, launch AS, it will ask for the SDK path. change the folder back to "sdk", and all is fixed Sep 06 21:15:42 HOURS spent on that. fuck me. Sep 06 21:16:02 id reinstall Sep 06 21:16:14 sdk path is a f pain Sep 06 21:16:15 JavaDog: donate yourself 2$ Sep 06 21:16:42 I'll only end up losing ~$0.20 because of wallet fees Sep 06 21:17:07 gdrc, now im using transactionmanager but what should i use to solve that problem and refresh that fragment that needs location Sep 06 21:17:14 replace? Sep 06 21:17:40 like a replace fragment with itself?... Sep 06 21:18:15 get the reference of the fragment and call a method like refresh() Sep 06 21:18:40 ok a sec Sep 06 21:19:13 Do I need to know Java before actual Android programming Sep 06 21:19:39 Of course yes Sep 06 21:20:57 a good understanding of java is a req. Sep 06 21:22:29 gdrc: he could use a listener interface or an event bus Sep 06 21:22:31 probably better Sep 06 21:22:41 i go to work with bus Sep 06 21:22:52 good input Sep 06 21:22:54 does that makes me an event? Sep 06 21:22:57 much valued Sep 06 21:23:42 im java master Sep 06 21:23:52 wow Sep 06 21:24:11 w0w* Sep 06 21:29:49 soo Sep 06 21:29:59 how much java do I need to know, or can I learn as I go Sep 06 21:30:29 you do need a rather good grasp of object-oriented programming Sep 06 21:30:37 Python? Sep 06 21:30:40 or you won't understand basic concepts in documentation and tutorials Sep 06 21:31:15 python=OOP. Is that ok? Sep 06 21:31:28 no Sep 06 21:31:39 no its not good youll just avoid oop Sep 06 21:31:49 KingInTheNorth didn't you ask these questions a few month ago ? haven't made much progress i see Sep 06 21:32:00 KingInTheNorth, just make a simple project and youll learn. best way to learn is a project. Sep 06 21:32:04 g00s: You remember <3 Sep 06 21:32:05 eh, I think the best way is just to think up a project you want to do Sep 06 21:32:07 and just start doing it Sep 06 21:32:12 learn on the way Sep 06 21:32:20 just have a basic understanding of boolean logics Sep 06 21:32:22 thats probably not the best way komugi Sep 06 21:32:23 No, I decided to just stick with python Sep 06 21:32:48 desmin88: to each their own, I guess Sep 06 21:33:10 komugi, that works if you know how to program well Sep 06 21:33:28 desmin88, my solution is clear and should work like a charm Sep 06 21:33:33 komugi, but when documentation expects you to create an anonymous class as a click callback and you don't understand any of the words in the sentence.... Sep 06 21:34:00 then research the stuff you don't understand :D Sep 06 21:34:20 that's basically how I learned almost every language Sep 06 21:34:31 except VB Sep 06 21:34:46 bye Sep 06 21:40:25 * KingInTheNorth sigh Sep 06 21:57:40 To any freelancer here: how do you get customers? Through your website, or with something else? Sep 06 21:58:33 sometimes yes Sep 06 21:58:36 networking too Sep 06 22:00:18 desmin88, Hm, I see. I also have to consider whether to have a company (with just me in it) or just me. Sep 06 22:00:43 llc Sep 06 22:01:06 Yeah, that was what I had in mind. It's just 80€ or so in the UK Sep 06 22:01:20 I'd have to fly there to open an account though Sep 06 22:08:55 You cant just open a company as a foreign national. YOu need a revenue registration. Sep 06 22:09:28 But you certainly dont need to be there to open a limited company. google. Sep 06 22:20:01 hey guys Sep 06 22:20:05 quick question Sep 06 22:20:24 why is application.getResources().getString(STRING ID) returning anull string Sep 06 22:20:31 cant i call resources from application or what? Sep 06 22:23:19 nvm Sep 06 22:25:55 * capella-s3 niw I'll never know Sep 06 22:31:28 do you receive an ANR if your initialization takes 5-10 seconds on the main thread when the app starts Sep 06 22:32:02 omg what is it you are doing ? Sep 06 22:32:08 and yeah I would think so Sep 06 22:34:25 LOL Sep 06 22:40:29 smitzer: your pasted code should not take 5-10 seconds Sep 06 22:40:35 you have a problem somewhere else in your app Sep 06 22:41:58 well if i do the initialization or not it differs in 2 seconds Sep 06 22:42:16 i mean if i call initializeHighscores2() or not it differs in 2 seconds Sep 06 22:42:24 I also decode bitmaps once in the beginning Sep 06 22:42:33 time how much it takes to do the entire transaction Sep 06 22:42:41 how? Sep 06 22:42:56 dirtily. get the system time before and after you insert all the values Sep 06 22:42:57 some gettime call pre and post? Sep 06 22:42:57 and subtract Sep 06 22:43:02 yes Sep 06 22:45:10 desmin88, what is the best way to do that? i find a lot of examples when i google but they use dateformat Sep 06 22:45:19 system.currenttimemillis Sep 06 22:45:38 did you run a tracer yet on your code? Sep 06 22:45:51 to see if you don't have another issue slowing you / code locking somewhere ? Sep 06 22:46:01 Mavrik i believe thats beyond his scope Sep 06 22:49:44 how do I get the view in a fragment? Sep 06 22:50:58 d00d. Sep 06 22:51:15 its literally the method name Sep 06 22:51:17 onCreateView Sep 06 23:01:55 desmin88 if ur initialization takes more them ~250ms u shouldn't be doing it on the main thread Sep 06 23:02:02 ur doing something very very wrong Sep 06 23:02:11 you should be talking to smitzer Sep 06 23:02:18 ... Sep 06 23:02:21 smitzer* Sep 06 23:02:23 desmin88 my bad :) Sep 06 23:03:11 my scope? Sep 06 23:06:40 http://pastebin.com/eAztp1Fs <- paste Sep 06 23:06:51 jug6ernaut, ^^ check initializeHighscores2 Sep 06 23:06:57 is there something wrong with that? Sep 06 23:08:11 why are u trying ecreating ur table ever time Sep 06 23:08:23 why all the db.closes () ? Sep 06 23:08:38 also, use transactions in a try {} finally {} block Sep 06 23:08:55 like every example i've ever seen, so it should be easy to find ;) Sep 06 23:09:32 * g00s passes out, too much lo mein Sep 06 23:11:49 jug6ernaut, what do you mean every time? Sep 06 23:12:37 smitzer every time u create that object your trying to create ur database again Sep 06 23:12:49 u should add a "if not exists" to ur create query Sep 06 23:13:18 yes i see but that is not the problem though Sep 06 23:13:54 what problem are you experiencing Sep 06 23:17:45 Who tries to delete a high score based on the actual score? Insane. eg "delete from scores where score=X;" .. my radar detects a nymshift..... Sep 06 23:18:04 lol Sep 06 23:18:53 though I was just injecting a little humour. it probably isnt doint it. But anyone than can paste code here that recreates the table each time its run and hasnt noticed really really needs to *learn to step through and use the debugger*.... Sep 06 23:18:56 ;) Sep 06 23:19:06 hello. would like to build a custom wifi manager (building a kiosk mode photo application) any reccomendations? Sep 06 23:19:28 smitzer: you forgot to close the db in getAllHighscores Sep 06 23:19:37 A custom wifi manager? High aims. Sep 06 23:20:25 jug6ernaut: he only drops the table on upgrade Sep 06 23:20:36 :| Sep 06 23:20:39 rgr: yeah, don't want to expose the whole android settings menu. Sep 06 23:21:08 onUpgrade -> dropTable Sep 06 23:21:09 xD Sep 06 23:22:34 smitzer: http://pastebin.com/VC7uineM Sep 06 23:22:55 jug6ernaut: aren't you supposed to drop your table? i mean, after copying out the values or whatever Sep 06 23:23:16 lasserix depends on what you are doing Sep 06 23:23:47 or i should say what the changes are Sep 06 23:24:59 rgr: whats wrong with my code? could you be a little constructive instead of condescending. The updating of the highscore works, maybe it could be done better though. im learning and just calling me stuff is not making me improve Sep 06 23:27:44 smitzer: http://pastebin.com/VC7uineM Sep 06 23:27:54 you should try finally all your db cursors Sep 06 23:28:02 so you guarentee they are closed once opened Sep 06 23:28:19 lasserix, ty Sep 06 23:28:20 "getReadbale();" Sep 06 23:28:22 lol Sep 06 23:29:10 yeah yeah Sep 06 23:29:26 :P Sep 06 23:29:27 smitzer: if you don't notice that is pseudo code so im sure i misspelled something here or there Sep 06 23:30:17 smitzer: also note you can catch an exeption between the try and finally if you want, so you can see how something fucked up by doing exception.printStackTrace() Sep 06 23:30:45 the try / finally construct just guarentees whatever happens in the try the finally portion will execute Sep 06 23:31:03 or that's the idea anyways Sep 06 23:31:25 well the finally block is normally guarenteed Sep 06 23:31:28 but 100% Sep 06 23:32:29 hey lasserix, I managed to modify and compile intent-intercept for api4 :) Sep 06 23:32:32 if your thread with the finally block in it gets stopped Sep 06 23:32:41 didn't even take long, just one lazy afternoon Sep 06 23:32:55 i just remember seeing (maybe) a so post doing some funky nested try / catches /finallys where the finally didn't execute (or i could be mistaken) Sep 06 23:33:00 ravilov: cool! Sep 06 23:33:11 you should PR the guy so he canreset minsdk version ;p Sep 06 23:33:34 lasserix: if the jvm dies or your thread gets stopped Sep 06 23:33:36 hah :p Sep 06 23:34:25 yes ty, but that isn't my problem Sep 06 23:34:39 smitzer: you should do it anyways Sep 06 23:34:45 it actually is your problem Sep 06 23:34:46 yes i will Sep 06 23:35:02 because you won't be able to guarentee it won't happen and this way you won't leak resources on your users' phones Sep 06 23:35:04 its probably not causing your apps slowdowns, but its still ap roblem Sep 06 23:38:21 yes ofc but it is not the problem I am trying to solve now Sep 06 23:40:47 you said you were decoding bitmaps on start Sep 06 23:40:52 have you figured out how long it takes to do that Sep 06 23:46:13 Can Log not be called from anywhere? Sep 06 23:48:47 it can Sep 06 23:52:07 09-07 01:49:09.885 20831-20831/com.sj.mazerace D/pretime﹕ 1410047348723 Sep 06 23:52:08 09-07 01:49:09.895 20831-20831/com.sj.mazerace D/posttime﹕ 1410047349902 Sep 06 23:52:08 09-07 01:49:09.895 20831-20831/com.sj.mazerace D/difftime﹕ 1179 Sep 06 23:52:17 1179 ms diff= 1.2 seconds Sep 06 23:52:32 not 2-3 secons but still longer than one would expect Sep 06 23:52:39 use a pastebin please Sep 06 23:53:14 thats your bitmap decoding? Sep 06 23:53:17 what would one expect? Sep 06 23:53:22 lol Sep 06 23:54:43 also smitzer do please try and read this : I know some fuddy duddies will rattle on garbage about it being 10x harder to debug your program than it is to do it wrote but that piece of historys was uttered 30 years or more ago when debuggers were rubbish as opposed to an integrated ppart of the development tool set. http://heather.cs.ucdavis.edu/~matloff/UnixAndC/CLanguage/Debug.html#tth_sEc3.1 Sep 06 23:54:53 s/wrote/right Sep 06 23:55:17 same applies for log vs debug break in many cases. Sep 06 23:59:43 smitzer: what is the problem you are having? Sep 07 00:01:16 lasserix: well I need to run my db initialization on a background thread Sep 07 00:01:31 on first use of my app, it takes 3-5 seconds to load Sep 07 00:01:42 now timing the db transactions that only accountsd for 1.2 seconds Sep 07 00:01:47 so there is more Sep 07 00:01:55 I also decode 2 images Sep 07 00:02:02 should move that to bg thread Sep 07 00:02:10 smitzer: just add a ExecutorService to your sqliteopnhelper with a fixed thread pool, wrap all your CRUDs in runnables and throw them on the queue and use the executor to run them Sep 07 00:02:13 I guess I could get an ANR if I take that long... Sep 07 00:02:30 or you can use async services too Sep 07 00:02:52 but the key about using a queue for your DB Is you'll guarentee transactionality Sep 07 00:05:44 what is the value of "com.sj.mazerace.global.Constants.NBR_LEVELS" Sep 07 00:08:13 desmin88, 45 Sep 07 00:08:40 im still not seeing how it takes 1.2 second to insert 45 rows Sep 07 00:08:48 something else is going on Sep 07 00:10:17 there is only 1 thread Sep 07 00:10:55 it still shouldnt take that long Sep 07 00:11:42 how many class files do you have in your app Sep 07 00:13:24 http://pastebin.com/g4KgTHnf Sep 07 00:13:39 how do I check how many class files I have? Sep 07 00:13:46 christ Sep 07 00:14:08 I know how many java files I have Sep 07 00:14:17 what does it matter? Sep 07 00:14:40 i was gonna say paste your entire app Sep 07 00:14:46 it its small Sep 07 00:14:49 if* Sep 07 00:15:43 it is not small Sep 07 00:16:03 8 fragments, maybe 30 java files Sep 07 00:16:12 well i cant help u anymore Sep 07 00:16:26 ill be back later if you still cant figure Sep 07 00:16:26 ok ty anyway Sep 07 00:16:28 it out* Sep 07 00:20:56 smitzer are you using primary key auto-int for this table? Sep 07 00:21:25 ahh no you are not Sep 07 00:21:30 you can modify your create table string to be Sep 07 00:22:32 INTEGER PRIMARY KEY NOT NULL AUTOINCREMENT Sep 07 00:22:38 for that part Sep 07 00:22:48 optimization #1: you don't need to allocate a new ContentValues instance for every insert Sep 07 00:23:43 just do values.clear() Sep 07 00:24:08 also, for timing/profiling purposes using System.currentTimeMillis() is usually preferrable Sep 07 00:24:58 I can't see anything else wrong there, you'll have to give the table definition for more advice Sep 07 00:26:37 http://pastebin.com/eAztp1Fs was his original paste of the full class Sep 07 00:27:20 smitzer: http://pastebin.com/vMnPr9Ka <--- you can use statements set you are using transactions Sep 07 00:27:28 *since Sep 07 00:27:36 ty Sep 07 00:27:51 don' use curretTimeMillis use SystemClock.upTime() Sep 07 00:28:02 currentTimeMillis isn't guarenteed to be monotonic Sep 07 00:28:14 only nanotime and systemclockuptime are Sep 07 00:28:27 (and only one the same thread) Sep 07 00:28:56 oh yeah, didn't think of statements Sep 07 00:29:11 well for 42 values its not really important ;p Sep 07 00:29:18 but if you do want to optimize you can Sep 07 00:29:19 still, it's a good practice ;) Sep 07 00:29:54 also smitzer you might considering adding _id as your primary key and then set its create table property to be INTEGER PRIMARY KEY NOT NULL AUTOINCREMENT Sep 07 00:29:56 currentTimeMillis isn't guarenteed to be monotonic <-- wow, really? didn't know that Sep 07 00:29:59 that way you have a real primary key Sep 07 00:30:23 http://developer.android.com/reference/android/os/SystemClock.html Sep 07 00:30:24 interesting Sep 07 00:30:40 INTEGER PRIMARY KEY NOT NULL AUTOINCREMENT Sep 07 00:30:43 https://www.cs.cmu.edu/~srini/15-446/android/android-sdk-linux_x86-1.0_r2/docs/reference/android/os/SystemClock.html Sep 07 00:30:51 noit sure what that means? i only know very basic sql Sep 07 00:31:04 basically means the first column will be a true primary key Sep 07 00:31:08 in that case don't worry about it, just use it ;) Sep 07 00:31:11 it's good Sep 07 00:31:21 that is, it'll automatically incremental the value for that column when you do inserts Sep 07 00:31:47 but it gives you a true primary key, so if you end up denormalizing your database structure you can actually do crossreferencing between tables reliably Sep 07 00:32:21 ie you want one table to be about players, one about scores, one about levels then now you have a handle in each to get to a value in another table Sep 07 00:33:47 Well this is intersting. I changed the order of things and suddenly the application loads in <1 sec Sep 07 00:33:53 and the db timing is 130 ms Sep 07 00:33:58 ahh Sep 07 00:33:59 intersting Sep 07 00:34:05 you sure it's still working right? Sep 07 00:34:09 you might then consider a compound pkey based on level, user and key : since a user can only have one "hiscore" for a particular level maybe. Look up foreign key relationships. Sep 07 00:34:22 s/key/score Sep 07 00:34:57 rgr probably better to have levels table since each level can only have one highest score, which is associated with one player Sep 07 00:35:03 hence denormalize! Sep 07 00:35:06 but really these timings for db access are meaningless at this stage. Especially since you were recreating the entire table each time your app started only half an hour or so ago. Sep 07 00:35:16 he's not? Sep 07 00:35:18 yes, totally. Sep 07 00:35:21 only on upgrade Sep 07 00:35:37 earlier his code was crecreating it each time. Sep 07 00:35:46 i dont remember seeing that Sep 07 00:35:52 in onCreate Sep 07 00:36:04 http://pastebin.com/nczftqLw Sep 07 00:36:08 http://pastebin.com/eAztp1Fs --> he only drops it onupdate Sep 07 00:36:10 http://pastebin.com/eAztp1Fs was his original paste and he isnt doing that Sep 07 00:36:19 how can changing when I set the fragment change the time so much? Sep 07 00:36:45 smitzer: you'd have to post the code snippet that is weird Sep 07 00:37:18 rgr: onCreate() in a sqliteopenhelper is only called once, when the database is first created Sep 07 00:37:50 yes, fair enough. Misread. Corrected. Sep 07 00:38:14 Id still have a database exists check but thats me. Sep 07 00:38:38 theres no reason to Sep 07 00:38:40 hey, anyone know of a workaround (including anything that can be done with root) to the removal of getRunningTasks? Sep 07 00:38:44 smitzer: are you sure your UI is still responsive? basically you made the layout happen first, but you should check if when you start the app the UI is actually responsive Sep 07 00:39:11 I was going to use getRunningTasks to whitelist activities for a parental-control style app (it's actually self-imposed, not parental control, but w/e) Sep 07 00:39:26 lahwran: fork the os? ;p Sep 07 00:39:44 you say fork the os, I read monkeypatch the runtime Sep 07 00:39:51 i am joking Sep 07 00:40:03 downgrade Sep 07 00:40:04 I don't really care what it takes since this is a personal device, and this app won't be shared Sep 07 00:40:08 I haven't upgraded Sep 07 00:40:11 but I want to be able to Sep 07 00:40:15 lasserix, well it should not be responsive until the db is initialized Sep 07 00:40:31 smitzer: no it should be responsive, just shouldn't start the game Sep 07 00:40:39 UI should __always__ be responsive Sep 07 00:40:45 first I see a white screen for <1 sec then I see my UI and when it loads it is responsive Sep 07 00:40:47 that is the problem with splash screens and such Sep 07 00:40:51 is there like, #android-root-dev somewhere? Sep 07 00:41:00 lahwran, look for a different ROM? anyway, outside of the scope of this channel Sep 07 00:41:13 lahwran: you might try like the cynogen channel Sep 07 00:41:14 there is #android-root Sep 07 00:41:33 ravilov: yes, I'm aware; as far as I know, that's more user facing, like #android Sep 07 00:41:46 lasserix: now there's an idea Sep 07 00:41:51 splash screens etc can still run perfectly well on a non main UI thread. I recently moved all my bitmap loading to an asnych thread. Lovely and responsive. Sep 07 00:41:54 smitzer: that's true for now, but your UI should always be responsive, if something can't happen until a load out, something else should still at least be responsive Sep 07 00:42:18 user-facing? hardly. more like system hacking Sep 07 00:42:56 eh Sep 07 00:43:01 lasserix, there is a small delay <1 sec when the app loads and at time there is a white screen like in most apps. then app loads and is immediately responsive. Sep 07 00:43:06 smitzer, at least show a ProgressDialog :) Sep 07 00:43:18 most apps do not have a white screen for one second that shows non responsive ui Sep 07 00:43:25 seems to vary how long it takes though, now it took almost 2 seconds Sep 07 00:43:33 smitzer, that often times happens when your onCreate takes too long Sep 07 00:43:51 delegate some of that somewhere else Sep 07 00:47:56 smitzer instead of a white screen, which you say takes one second but only on the device you are playing with currently, you could show for instance a dummy game happenning Sep 07 00:48:10 or something other than a fugly white screen (of unresponsiveness) Sep 07 00:48:14 it'll make your game cleaner Sep 07 00:49:56 yes Sep 07 00:50:06 or fix the reason his app is taking so long to start Sep 07 00:50:07 and that is what I have been checking out Sep 07 00:50:24 I kind of find AsyncTask ugly though. Sep 07 00:50:35 why? Sep 07 00:50:38 it seems easy to make a mess out of threads on android Sep 07 00:50:49 it can be if you don't know what you're doing Sep 07 00:50:52 then dont be messy Sep 07 00:51:09 it is not android-specific, it can happen on any threaded system Sep 07 00:51:34 but "I don't know how to use it right" is hardly an excuse to not use the right thing Sep 07 00:51:45 but is it a problem from an ANR perspective if there is an unresponsive white screen? Sep 07 00:51:58 just assume it is Sep 07 00:52:27 stop talking about ANR Sep 07 00:52:32 assume such a situation is unacceptable Sep 07 00:52:52 smitzer: UI should _always_ be responsive, it is that simple. Sep 07 00:52:53 if it is acceptable for you, it will surely not be acceptable for your users Sep 07 00:53:09 and will make you look like a crap of a dev Sep 07 00:56:52 anyone ever had a problem with an ADB device stating it's offline even after approving the PC's RSA fingerprint? Sep 07 01:00:43 well, always responsive? you mean always show something, I will just show a progress bar and "game is loading". good enough? Sep 07 01:00:59 can my app be closed down if that part takes to long? Sep 07 01:02:05 smitzer: It'll only launch an "app not responding" dialog if the loading is taking place on the main thread. Load on a background thread and there won't be a problem. Sep 07 01:03:49 and you recommend an Asynctask? Sep 07 01:04:07 that's probably the easiest way to deal with it, yeah Sep 07 01:04:09 some people recommend an event bus with the asynctask Sep 07 01:07:34 ProgressDialog on ui thread, all loading and preloading in a separate thread (or asynctask or whatever) Sep 07 01:07:40 done Sep 07 01:07:42 profit Sep 07 01:07:45 So onPostExecute the AsyncTask would run something on the UI thread to switch fragment Sep 07 01:07:59 that would work Sep 07 01:08:06 not sure about the profit :) Sep 07 01:08:24 well, your app won't look like it's frozen to users, which is a big plus Sep 07 01:08:43 long loading should be done on a background thread, always. It's not very difficult. Sep 07 01:15:28 now my AsyncTask has a reference to the activity, this seems wrong but necessary unless ofc I create a global database handler Sep 07 01:16:14 you should only pass the applicationcontext your sqliteopenhandler Sep 07 01:16:17 not your activity Sep 07 01:16:56 getActivity().runOnUiThread( new Runnable() Sep 07 01:17:18 is it ok to run that in the AsyncTask in onPostExecute and make a fragment transaction there? Sep 07 01:19:52 Interestingly my device only goes 'offline' after I start android studio. ADB works fine before that. fuck you, AS. goddamn. Sep 07 01:20:38 desmin88, what exactly is the application context? Sep 07 01:20:46 google Sep 07 01:20:49 does anyone know where android studio stores its ADB key? I suspect it's a problem with that Sep 07 01:21:50 alright AS, you're getting reinstalled. I'm tired of you shit. Sep 07 01:21:53 your* Sep 07 01:22:06 JavaDog: now, I can't say I actually know what's going on. but I've noticed adb seems to really dislike when I have multiple devices - real or emulated - "plugged in" at once Sep 07 01:22:14 there's only one Sep 07 01:22:14 if it's doing something emulator-ey, maybe that could do it? Sep 07 01:22:28 oh wow, it only wants to work in one USB port Sep 07 01:22:31 the first one I plugged it into Sep 07 01:22:34 what the hell Sep 07 01:22:36 oh wat Sep 07 01:22:58 which I don't use because it disconnects then reconnects several times per minute Sep 07 01:22:59 ughhhh Sep 07 01:23:06 what OS are you coding on Sep 07 01:23:12 windows 8 x64 Sep 07 01:23:53 let me try a different port with a different cable. maybe that will satisfy it Sep 07 01:24:07 (this is my old galaxy nexus I'm trying to use for testing. my note 3 works fine in every port) Sep 07 01:24:13 JavaDog: that happens to me too, one of the USB ports keep reconnecting Sep 07 01:24:31 I would just use adb over wifi but that never wants to work either Sep 07 01:25:20 I'm getting seriously pissed with AS. The last few days have been 10% coding, 90% fixing dumbass problems with this IDE Sep 07 01:25:27 JavaDog: you probaly have to reinstall the USB specific drivers for that phone Sep 07 01:25:33 already did that Sep 07 01:26:00 it's only android studio. ADB works fine on any USB port until I start AS Sep 07 01:26:20 does it work fine with Eclipse ? Sep 07 01:26:26 don't have eclipse installed Sep 07 01:26:47 AS is getting reinstalled now. going to see if that helps anything (prediction: nope) Sep 07 01:27:30 JavaDog: you should remove the user settings directory that AS leaves, so when you reinstall, your old settings don't come back Sep 07 01:27:45 user_home/.AndroidStudio, right? Sep 07 01:27:58 AndroidStudioBeta* Sep 07 01:28:24 yeah something like that Sep 07 01:28:29 peeved that I have to reconfigure everything again but I guess there's no other way since I can't even develop anything Sep 07 01:29:01 you use any virtual devices? Sep 07 01:29:17 nope Sep 07 01:29:21 as doesn't work with my phone if I launch some of those Sep 07 01:29:38 have to restart it each time Sep 07 01:30:06 I had one once a few days ago but this phone worked until tonight and I haven't launched an emulator recently Sep 07 01:30:39 must be frustrating. Sep 07 01:31:22 Only a couple hours ago I finally fixed AS not showing quick documentation for anything android-related; that took at least 4 hours because it seems nobody has ever had my problem before Sep 07 01:31:32 Maybe my download was corrupted? I have no idea Sep 07 01:32:53 I would punch my monitor if it weren't so expensive Sep 07 01:33:36 obstacles are a part of the challenge Sep 07 01:34:03 enjoy solving it like a trip, at least you'll learn what was wrong Sep 07 01:34:13 JavaDog: ugh, that feeling is no fun Sep 07 01:34:45 I don't generally feel awesomely successful after battling stupidity like that, just really annoyed :/ Sep 07 01:35:13 It's mostly frustrating because I know I'm not doing anything "wrong". My computer just doesn't want to get along with AS and it's not my fault for any legitimate reason I can see. I feel successful after tackling a programming challenge, but this is some bullshit. Sep 07 01:35:48 I can't even write my program. I'm battling with the software that's supposed to let me do that Sep 07 01:36:34 it could be one of a million things, now which one is it, who dun it? will we find out ? stay tuned folks Sep 07 01:36:38 you bark at it, and it'll go away. my dog's fav tactic Sep 07 01:36:49 believe me, I've tried Sep 07 01:36:55 if screaming counts Sep 07 01:36:59 if I want to switch fragment when the loading is done, should I do it onPostExecute from the asynctask and post a runnable to the UI thread? Sep 07 01:37:16 onPostExecute runs on the UI thread, so you can just do it from there Sep 07 01:38:13 to be more specific: onPreExecute, onProgressUpdate, and onPostExecute run on the UI thread Sep 07 01:39:05 and doInBackground() runs off UI Sep 07 01:41:44 I want a drink but I've already had two... Sep 07 01:41:55 and about a week's share of nicotine Sep 07 01:43:39 just use gradle to build and run Sep 07 01:43:45 interesting. Last time I installed android studio, the default install location was Program Files (x86) Sep 07 01:43:49 android studio to write code Sep 07 01:43:51 this time it installed to AppData Sep 07 01:44:17 I wonder if that was the source of my many problems Sep 07 01:44:30 doubtful Sep 07 01:45:00 the program files folders need admin access to be written to (I want to punch the person who thought of that idea) Sep 07 01:45:06 appdata does not require that Sep 07 01:45:54 it's in appdata here, too Sep 07 01:48:45 http://pastebin.com/jXELfUc8 <- whats wrong with my AsyncTask, it doesnt finish and then crashes Sep 07 01:49:06 of course it should require admin access Sep 07 01:49:55 maybe the folder as a whole, but a program should be able to modify its own subfolder without admin access Sep 07 01:50:00 no concept of computer security if you want to punch someone for requiring that Sep 07 01:50:15 nm Sep 07 01:50:19 doesn't work that way Sep 07 01:50:19 and no Sep 07 01:50:31 nope, reinstall of AS didn't fix shit. awesome. Sep 07 01:50:42 I don't want a program that looks legit to change itself without my knowledge Sep 07 01:50:56 that's pretty much the ripest Avenue for malware Sep 07 01:51:00 reinstall windows!! Sep 07 01:52:04 I disabled UAC because I'm not an idiot and I don't download shady torrents. Applications should be able to write where they want Sep 07 01:52:15 AppData has effectively become what program files used to be Sep 07 01:52:18 ..uac's the best that happened to windows since xp, apart from the new core Sep 07 01:52:36 i have uac disabled and have no antivirus :p Sep 07 01:52:41 uac is pretty great Sep 07 01:52:47 desmin88: exactly Sep 07 01:53:33 ... Sep 07 01:54:05 oh and i disable windows firewall Sep 07 01:54:40 right, and those guys running apps in chroots are just crazy, right? Sep 07 01:55:15 One time I was like git commit -a then I was like typin stuff then I was like :wq Sep 07 01:55:23 well one of them didn't and I could reboot his machine remotely Sep 07 01:55:28 goood times. Sep 07 01:55:34 he wasn't pleased Sep 07 01:56:03 * JavaDog gets another beer Sep 07 01:56:59 Fenny... are you the Fenny I know? Sep 07 01:57:06 UNCC? Sep 07 01:57:09 Hi all. Quick xml drawables question. Im trying to create a shape drawable in xml that has a gradient at the top and bottom. Sep 07 01:57:17 JavaDog: I see your problem Sep 07 01:57:23 it's the beer Sep 07 01:57:31 I refuse to believe that Sep 07 01:57:34 Specifying start, end and center gradient doesn't quite cut it, I want the top and bottom gradient to only span say, 10% of the height of the drawavle Sep 07 01:57:35 Any ideas? Sep 07 01:57:53 timusus: I've actually done that before. Let me see if I can find it Sep 07 01:57:55 Naw, JavaDog. Sep 07 01:57:59 Aw Sep 07 01:58:06 Thanks Sep 07 01:58:09 timusus: two gradients? Sep 07 01:58:15 Yeah, I guess Sep 07 01:58:26 that was a suggestion Sep 07 01:58:30 Yeah aha Sep 07 01:58:37 I was just registering that Sep 07 01:58:46 tee hee Sep 07 01:59:11 In terms of height of the drawable, the middle 80% is completely transparent Sep 07 01:59:24 But the top and bottom 10% I want to have a slightly darker overlay Sep 07 01:59:28 there's layer list or something like that. Sep 07 01:59:45 I'd just make a 9 patch Sep 07 01:59:47 Yeah, but I don't know how to use it, and there are literally hundreds of different tutorials with different aplications Sep 07 01:59:50 Ugh Sep 07 01:59:59 I can't work with 9 patches Sep 07 02:00:10 I mean, I do, but not willingly Sep 07 02:00:16 :o but but Sep 07 02:00:33 * sq ♥ 9patch Sep 07 02:00:38 drawable xml introduces overdraw Sep 07 02:00:43 Hm... it appears that at least one of the USB ports on the front of my tower is kinda fucked up. Maybe this is the true source of my issues. Sep 07 02:01:20 I'm not particularly worried about overdraw here Sep 07 02:01:31 wasn't it the first thing you checked? Sep 07 02:02:12 but yeah, sometimes I too forget to check if there's power before running gdb Sep 07 02:02:31 Well it worked for other things Sep 07 02:02:35 my onPostExecute is never called? Sep 07 02:02:38 but maybe it's a combination of that and this oldass cable Sep 07 02:02:38 Does layer-list stack the shapes on top of each other? Sep 07 02:02:59 Ah, poor explanation/question Sep 07 02:03:14 I mean, are they overlaid on each other in the z plane? Sep 07 02:03:45 Because I'd like to arrange the shape drawables such that one takes, say 10dp, the next one 80dp, and the last 10dp Sep 07 02:03:52 Similar to a linear layout's children Sep 07 02:03:57 oh god damn it. Yeah, I plugged the phone into a port on the back and it was fine... Sep 07 02:03:58 Hello friend... please help. i kept reciving error ---> android.database.sqlite.SQLiteException: near "@gmail" -> http://pastebin.com/aRQcNqL0 Sep 07 02:03:59 As opposed to a FrameLayout's children Sep 07 02:04:02 * JavaDog slits wrists Sep 07 02:04:06 timusus: you should be worried about overdraw Sep 07 02:04:10 I'm not Sep 07 02:04:14 why Sep 07 02:04:15 It's not a concern at this point Sep 07 02:04:22 JavaDog: try Eclipse Sep 07 02:04:23 This is a view drawn once Sep 07 02:04:24 Fuck overdraw man. Don't even let it get to you Sep 07 02:04:27 It's not part of a listview Sep 07 02:04:32 It's not a problem here Sep 07 02:04:39 And I'm minimising overdraw everywhere anyway Sep 07 02:04:39 don't listen to them, timusus Sep 07 02:04:44 yeah you know it Sep 07 02:04:48 god I'm drunk Sep 07 02:04:55 JavaDog r u ok Sep 07 02:05:03 yeah mostly Sep 07 02:05:12 Na I'm here to work out how to achieve a solution using shape drawables. Overdraw can come later Sep 07 02:06:04 I think overdraw is far more significant/of concern if it's an element of a moving view Sep 07 02:06:18 In this case, it's not, there's nothing else laid on top of it, and I don't care about it Sep 07 02:06:51 Question: How can I create a shape drawable, where the first shape is 10dp in height, the next shape is 80dp and sits under it, and a third shape is 10dp and sits under that? Sep 07 02:06:53 Hello friend... please help. i kept reciving error ---> android.database.sqlite.SQLiteException: near "@gmail" -> http://pastebin.com/aRQcNqL0 Sep 07 02:07:06 my onPostExecute is never called? Sep 07 02:07:15 hackable: its been like 3 minutes, stop Sep 07 02:07:15 Basically a vertically aligned LinearLayout version of a shape drawable Sep 07 02:07:38 is there some common reason to look for when onPostExecute is not called by AsyncTask? Sep 07 02:07:50 no 2 times Sep 07 02:08:07 hackable: post a stack trace Sep 07 02:08:15 smitzer, is your doInBackground executing? Sep 07 02:08:35 smitzer: I believe you have to call asynctask.run or something like that Sep 07 02:08:40 ok Sep 07 02:08:42 execute? Sep 07 02:09:08 timusus, yes Sep 07 02:09:18 JavaDog, I call execute Sep 07 02:09:23 oh I read that as doInBackground Sep 07 02:09:26 And it's calling through to the end of that method? You sure it's not failing at some point? Sep 07 02:09:27 ignore me Sep 07 02:09:35 oh, onpostexecute not running. Sep 07 02:09:45 that happens if the asynctask is ended a certain way... Sep 07 02:09:51 Maybe pastebin your asyntask Sep 07 02:10:12 Can someone tell me how to vertically stack shapes in an xml drawable? Sep 07 02:10:47 smitzer: Do you have an @Override annotation on your asynctask implementation? If not, you might not be implementing it correctly Sep 07 02:11:43 on all the methods in it, rather Sep 07 02:12:12 JavaDog, only on doInBackground actually, not on onPostExecute Sep 07 02:12:23 add one on there as well Sep 07 02:12:33 And make sure you're not using primitive types Sep 07 02:12:56 like ... = new ASyncTask Sep 07 02:12:59 you want Integer instead Sep 07 02:13:09 Void, Void, int* Sep 07 02:13:47 and then for onPostExecute it would be public Integer onPostExecute(whatever...) {... Sep 07 02:14:34 but your IDE will help you once you add the @Override annotation Sep 07 02:15:10 JavaDog, ty now it works Sep 07 02:15:16 good ^^ Sep 07 02:16:10 JavaDog, any luck finding that drawable? Sep 07 02:16:19 oh I forgot. hang on Sep 07 02:17:15 Looks like I lost that project at some point, sorry :( Sep 07 02:17:21 never finished it Sep 07 02:17:28 no problem Sep 07 02:19:43 transparent stuff in 9 patches doesn't contribute to ovedraws btw Sep 07 02:20:29 yup Sep 07 02:20:45 google apps use 9 patch extensively Sep 07 02:22:59 I struggle to create 9 patches that do what I want Sep 07 02:26:00 yeah.. Sep 07 02:29:50 mhm my app had way too much overdraw Sep 07 02:30:03 never knew it's so easy to debug Sep 07 02:30:21 thanks timusus Sep 07 02:33:12 huh? Sep 07 02:33:47 Anyone know how to set the height of a View in a RelativeLayout programmatically? Sep 07 02:34:07 LayoutParams Sep 07 02:34:19 what's the attribute I set though? Sep 07 02:34:28 height Sep 07 02:34:29 already got a LayoutParams going Sep 07 02:34:30 lol Sep 07 02:34:39 params.height Sep 07 02:34:42 sure it's not width? Sep 07 02:35:20 "Anyone know how to set the height" Sep 07 02:35:38 XD Sep 07 02:35:51 oh Sep 07 02:35:58 you little jokester you Sep 07 02:36:09 Who you callin' little? Sep 07 02:36:18 yeah still not seeing it Sep 07 02:36:28 show me, smart guy Sep 07 02:36:41 params.addRule(what); Sep 07 02:36:44 Who you callin' smart? Sep 07 02:36:49 you, smart guy Sep 07 02:37:04 all of you not-drunk smart guys Sep 07 02:37:11 think you're smarter than us drunk people Sep 07 02:37:20 literally Sep 07 02:37:27 just do params.height = whatever Sep 07 02:37:38 there is no setter or getter or whateverer Sep 07 02:37:41 what unit is that in? Sep 07 02:38:01 px Sep 07 02:38:20 to convert Sep 07 02:38:33 TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, *pixel value), getResources().getDisplayMetrics()); Sep 07 02:38:44 aha Sep 07 02:39:05 huzzah Sep 07 02:39:53 I have a Broadcast receiver with this action but for some reason the onReceive is not being called. The BroadcastReceiver is in a Fragment Sep 07 02:40:02 http://stackoverflow.com/questions/3767591/check-intent-internet-connection this is what I followed Sep 07 02:41:31 connectivity_chang Sep 07 02:41:51 params.height needs an int and applyDimension supplies a float. Sep 07 02:41:51 chang Sep 07 02:42:02 I'm afraid to just convert it because that will lead to inconsistency Sep 07 02:42:05 how drunk are you Sep 07 02:42:07 (but probably not a lot) Sep 07 02:42:15 are you sure you didn't mean connectivity_cheng Sep 07 02:42:26 or lin_chao_connectivity Sep 07 02:42:31 JavaDog: cast to int Sep 07 02:42:37 you sure? Sep 07 02:42:50 timusus: thanks dude 0.o Sep 07 02:42:50 no Sep 07 02:42:51 i mean yes Sep 07 02:42:54 i should stop copy pasting :D Sep 07 02:42:58 just cast it to int, you will be fine. Sep 07 02:43:01 lol Sep 07 02:43:28 android.net.conn.LIN_CHAO_CONNECTIVITY_CHANG Sep 07 02:43:36 works for me Sep 07 02:44:26 I still have that little white screen in the beginning, it is shorter but it is still there... Sep 07 02:44:26 JavaDog you could put your value in res/values Sep 07 02:44:35 it is there Sep 07 02:44:45 excellent job guys, exactly what I was going for http://i.imgur.com/5MamSAj.png Sep 07 02:44:46 So why are you worried about inconsistency Sep 07 02:44:58 timusus: LOL Sep 07 02:47:34 my definition of 72dp appears to translate to "the entire fucking screen" in android Sep 07 02:47:38 lol Sep 07 02:48:03 is there any library for drawing a 'hand' over the screen to show gestures? Sep 07 02:48:16 I feel vaguely like I'm working with CSS... Sep 07 02:48:43 I am getting no empty constructor when BroadcastReceiver is being called, is this because it is part of the Fragment class? Sep 07 02:48:59 for example when you view all your apps for the first time Sep 07 02:49:10 I avoid programmatically setting layout params as much as possible Sep 07 02:49:17 Any reason why you don't just do it via xml? Sep 07 02:49:23 also, what's you layout params code Sep 07 02:49:49 params.height = R.dimen.mediacontrols_size; Sep 07 02:49:56 also tried the conversion code thing Sep 07 02:50:27 Can you show the entirety of your setting layout params code Sep 07 02:50:29 (pastebin( Sep 07 02:50:31 ) Sep 07 02:50:46 wait a sec, I might be more of an idiot than we previously thought' Sep 07 02:51:00 nope Sep 07 02:51:17 http://pastebin.com/yJbhXPEr Sep 07 02:53:00 Hmm Sep 07 02:53:03 No idea haha Sep 07 02:53:24 I never have simple problems anymore. I'm too pro. Sep 07 02:54:24 detachYo: A Fragment needs to have a no-arg constructor and no other constructors Sep 07 02:54:33 Err Sep 07 02:54:46 You can definitely have other constructors Sep 07 02:54:51 (technically it can have other constructors but the docs say to avoid it) Sep 07 02:55:19 But everyone uses the newInstance() pattern which I think is pretty much recommended everywhere (but the docs) Sep 07 02:55:26 And is insanely useful Sep 07 02:55:44 yeah because your bundle gets restored Sep 07 02:55:50 JavaDog: it does. Sep 07 02:55:53 the docs say to use the Fragment.setArguments(Bundle) method instead Sep 07 02:56:38 The docs are shit Sep 07 02:56:59 lol, smart guy Sep 07 02:57:20 what's the newinstace pattern? Sep 07 02:57:22 they're not as shitty as the docs for my microwave, so they're not too bad IMO Sep 07 02:57:32 I can't remember what it's actually called Sep 07 02:57:39 factory? Sep 07 02:57:44 no Sep 07 02:58:09 well Sep 07 02:58:17 ehh "static factory method" Sep 07 02:58:43 if I do setContentView( R.layout.loading_layout ); and in that layout I have android:name="com.sj.mazerace.LoadingFragment" Sep 07 02:58:47 For those who wonder. I had to make the class static Sep 07 02:58:56 why do I have to call the Fragment transaction methods? Sep 07 02:59:18 You don't if you do what you described Sep 07 02:59:36 You can either instantiate your fragment via xml, as you have done - or programmatically using the transaction methods Sep 07 02:59:54 Programmatically is more useful if you'll be swapping fragments etc **** ENDING LOGGING AT Sun Sep 07 02:59:59 2014