Posts

leave Android app in final state on espresso test completion -

is possible leave app under test in whatever state it's in @ end of espresso test? don't care if it's failure or success. when working on developing feature , test said feature useful have instrumentation app stop , leave app under test alone in whatever state happens in. allow me play around manually or attach debugger , see going on without running through entire flow manually. anyone know if possible? there multiple actors in play try kill activities... had provide custom rule , custom runner behavior wanted. documented here: https://gist.github.com/dbachelder/4d0588ab6adf0aa6e69a

java - Either show notification or react in application -

i have background service doing work - retrieving user location interval (launched startservice ). special condition reached i'd following: if application in foreground start specific activity. if application not in foreground or closed show notification start required activity on tap. i know how show notification , how handle intent server broadcast receiver example. how can determint if application in foreground? or may can suggest complete better solution? i determint if application in foreground there's couple of ways find out in front, prefer track myself (as helps me apply additional logic if needed). plus it's pretty simple task. make happen need static int based counter somewhere (you can use application object if have one, or have elsewhere, not matter). in each activity 's onresume() increment counter one, , in onpause() decrement one. if counter equals 0 none of activities in foreground perspective in background , post notificat...

spotify - Simultaneous output from libspotify -

i'm curious if it's possible use libspotify play multiple files @ once, through different outputs. want able play 1 song through speakers , jump around through other songs on headphones when djing. does know if possible? if it's doable offline files i'm ok that. i'd fine having 2 separate processes running libspotify if that's works. thanks! no, not possible. libspotify stop playback of first track , call play_token_lost() callback.

Update Software when update is available using C# -

i include software update in application check shared location or url such shared url google drive replace old .exe , config files. if new update available, user should notification etc.. guide me on how can achieve or if feasible? it feasible. there 1 solution called clickonce can check updates @ every launch. the other way have program updater since windows won't allow overwrite opened file (the main program can update updater) however, recommend dropbox's public folder host files, has several advantages on gdrive imho (direct download link (gdrive sharing link redirects download page, gdrive host url not report downloaded file size)) edit : use clickonce dropbox's public folder follow steps : (i'll assume have dropbox sync client installed) 1. (not mandatory if plan host 1 project) create subfolder in dropbox public folder :) 2. open project's properties go in "properties tab" 3. first box publish application (select folder cre...

javascript - Select2 4.0 clicking item doesn't fire select2:select -

i'm using select2 4.0 , when load data json file none of created elements fire select2:select event. thought have event delegation, examples on website seem fine. i've been breaking head on past hour , don't understand i'm missing. right i'm using select item, doesn't work: $("body").on("click", "#select2-select-results .person-entry", function() { var $this = $(this); var name = $this.data('name'); select2.find('option').val(name).text(name); }); binding $(...).on('select2:select'); never fires, $(...).on('select2:open); does. i'm not sure what's going on. what did notice however, when data has been loaded, no <option> tags created. this entire javascript that's handling thing: (function($) { "use strict"; var term = null; var select2 = $("#select"); select2.select2({ allowclear: true, ajax: { ...

android - ListView Adapter calling getView with the same index 3 times despite there being 17 items in arraylist -

as title says, adapter doesn't work. i've given arraylist of string arrays. arraylist contains 17 string arrays. result should 17 rows in list view. alas, fails me. @override public view getview(int index, view arg1, viewgroup parent) { layoutinflater inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); view view = inflater.inflate(r.layout.courses_list, parent, false); textview modulecode = (textview) view.findviewbyid(r.id.modulecode); modulecode.settext(list.get(index)[0]); log.i("list-get", integer.tostring(index)); textview modulename = (textview) view.findviewbyid(r.id.modulename); modulename.settext(list.get(index)[1]); textview modulecredits = (textview) view.findviewbyid(r.id.modulecredits); modulecredits.settext(list.get(index)[2]); checkbox c = (checkbox) view.findviewbyid(r.id.modulecheck); c.setchecked(true); return view; } this logcat outputs: ...

winforms - Windows Forms Chart: Get mouse cursor coordinates in Chart axis scale? -

Image
i have problem following sample: when click @ place marked '1' on screenshot, can position in pixels mouseclick event in pretty easy way: private: system::void chart1_mouseclick(system::object^ sender, system::windows::forms::mouseeventargs^ e) { point chartlocationonform = chart1->findform()->pointtoclient(chart1->parent->pointtoscreen(chart1->location)); cursorposx = e->x - chartlocationonform.x; cursorposy = e->y - chartlocationonform.y; } after printing these values out, position in pixels, position marked '2' equal (0,0). what after clicking spot in '1' is x: 40 y: 178.5 , which coordinates inside chart . there civilised way (i mean other considering padding, margins , borders of chart , calculating these coordinates myself)? one of ideas create sort of invisible cursorx , cursory , use methods , still seems more fancy way solve simple problem real, straight-forw...