Posts

java - onDraw Method not Called? -

i creating custom view ondraw method never being called. tried doing - setwillnotdraw(false) still doesn't work. in fact, doesn't work after calling invalidate() . here's code - public class box extends view { public box (context context) { super (context); init(); } private void init() { // initialize paint object paint = new paint(); paint.setstyle(paint.style.fill); paint.setcolor(mboxcolor); setmeasureddimension(200, 200); } @override protected void ondraw(canvas canvas) { super.ondraw(canvas); canvas.drawrect(100, 100, 200, 200, paint); } } my activity code - box box = new box(this); please help in mainactivity.java use setcontentview(box);

google maps - Is API Key Required for Direction Apis Android -

i using below code directions particular lat & lng using google api. have not used api key. app making pushed playstore. want make sure doing here correct or cause problem me ? thanks in advance :) if (pc.getlatitude() != null && pc.getlongitude() != null) { double latitude = double.parsedouble(pc.getlatitude()); double longitude = double.parsedouble(pc.getlongitude()); string uri = string.format(locale.english, "http://maps.google.com/maps?daddr=%f,%f (%s)", latitude, longitude, "location"); intent intent = new intent(intent.action_view, uri.parse(uri)); intent.setclassname("com.google.android.apps.maps", "com.google.android.maps.mapsactivity"); if (intent.resolveactivity(mcontext.getpackagemanager()) != null) { toast.maketext(mcontext, r.string.toast_opening_google_maps, toast.length_short).show(); mcontext.startactivity(intent); } else { ...

xslt - I get expected output only if I remove the strip-spaces -

Image
i'm writing xslt in below xml <?xml version="1.0" encoding="utf-8"?> <body> <para> <page num="794"/>20 july 2009 </para> <para> cont1<case> <casename> <content-style font-style="italic">cont1</content-style> &#x0026; <content-style font-style="italic">drs</content-style> </casename> <content-style font-style="italic">cont1</content-style> </case> cont1 <case> <casename> <content-style font-style="italic">cont1</content-style> &#x0026; <content-style font-style="italic">cont1</content-style> &#x0026; <content-style font-style="italic">mergcont</content-style> </casename> <content-style font-style="italic">[2004] 3 ...

C# performance: construct new collection with existing items using constructor or loop? -

i've searched not found answer, maybe because question not easy describe. example in wpf, have model test , , list<test> lst , have construct observablecollection<testviewmodel> obstests . there maybe 2 ways: var obstests = new observablecollection<testviewmodel>(lst .select(t = > new testviewmodel(t)); var obstests = new observablecollection<testviewmodel>(); foreach(var test in lst) { obstests.add(new testviewmodel(test)); } please tell me better in performance, , tell me best solution if asparallel available(such is observablecollection threadsafe ? i'm using .net 4.5 ) there no difference. ctor uses add method base class collection : reffer: click ! public observablecollection(list<t> list) : base((list != null) ? new list<t>(list.count) : list) { copyfrom(list); } private void copyfrom(ienumerable<t> collection) { ilist<t> items = items; if (collection != null && ite...

xunit.net - Why doesn't .NET Core and xUnit recognise my imported namespaces? -

i have project compiles want test using xunit. although project lets me add references , builds, add using statement test class red squiggly lines , error "type or namespace not found." even though xproj of project want test has been added references, , namespaces exist. has have done, can't see what. using earlier versions of .net, have added references test projects hundreds of times without issue. so different in way .net works, , why not recognize namespaces in referenced assemblies? update : have removed xunit , got mstest working, have same issue. may feature of way have dotnetcore set up, , references in json files more else. this structure works me in .net core 1.0: global.json { "projects": [ "src", "test" ], "sdk": { "version": "1.0.0-preview2-003121" } } src/mylibrary/project.json { "dependencies": { }, "frameworks": { "netstandard1...

Android Studio 1.5.1 Setup -

Image
hi guys i'm trying install android studio 1.5.1 following standard setup phases having following error. i've jdk version 1.7 : it looks if failed stop adb service @ 1 point during installation. try running installation second time, , should skim on already-installed components , install missing one. similar post on stackoverflow: error: stopping adb server failed (code -1) {installing api's - android sdk}

php - Radio button text area -

i have survey form works fine. need 1 question changed. there's 2 radio buttons answers "yes" , "no" , text area under them. want text area locked unless user selects "yes" radio button can type in text area reason "yes". i did looking around , attempting function doesn't seem working. <script> function validate() { var radioyes = document.getelementbyid('radioyes'); var textarea = document.getelementbyid('question5comment'); if (radioyes.checked && question5comment.value.length < 1) { alert('please enter reason question 5.'); question5comment.focus(); return false; } } function toggle(value) { document.getelementbyid('question5comment').disabled = value; } </script> 5. using other non-franchise service centres? <br> *if yes there other reason other price <br> <input type="radio...