Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

android - Different Instance of Applicationcontext in Broadcastreceiver -


i want access "global" variable in myapp(extends application) broadcastreceiver (registered in manifest) , e.g. multiple activities. seem have different instances of myapp: 1 bcr , 1 activities. sb me problem? alot joerg

what trying create method having single context object. first off, need singleton pattern of myapp create "global" variable. advice against these reasons:

  1. different application components default have different contexts (base, application).
  2. a broadcastreceiver defined in manifest invoked os, not application.
  3. using singleton pattern context object lead nasty dependencies.
  4. you going against design , beauty of android framework.

i suspect reason doing myapp class can start different activities. makes sense, but... can context object anywhere. many things in android extend contextwrapper class (think java objects object class). there no reason ever have "global" instance of this. in fact broadcastreceiver's onreceive() method accepts context parameter. can use start activities , not.

if not why wanting myapp singleton class - , there justifiable reasons needing it, @ implementation designed bill pugh safest in java taking account thread synchronization , locking.

hope helps. remember, don't fight sdk, let work you!


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -