tag:blogger.com,1999:blog-5819005.post3515712052467515199..comments2024-03-16T02:17:55.433-07:00Comments on Programming and politics: The Static Starter PatternAnonymoushttp://www.blogger.com/profile/08698131967747444207noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5819005.post-69722313501733315632017-04-19T03:04:10.526-07:002017-04-19T03:04:10.526-07:00Starter pattern does not run until I set flag to i...Starter pattern does not run until I set flag to intent as follows<br /><br /> intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);<br /><br />otherwise it gives exception as follows<br /><br /> android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?<br /><br />Why?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5819005.post-22735630403551567082013-03-07T07:35:20.635-08:002013-03-07T07:35:20.635-08:00For an even more automated way to do this, have a ...For an even more automated way to do this, have a look at Android Annotations, and its IntentBuilder: https://github.com/excilys/androidannotations/wiki/HowItWorks#StartingAnAnnotatedActivityAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5819005.post-23020933183882775802013-02-07T22:08:58.672-08:002013-02-07T22:08:58.672-08:00i just discovered that google does this in their o...i just discovered that google does this in their own contacts app. take a look at the buildIntent method here (https://github.com/android/platform_packages_apps_contacts/blob/master/src/com/android/contacts/activities/PhotoSelectionActivity.java) for example.ahmedrehttps://www.blogger.com/profile/12438536861409713509noreply@blogger.comtag:blogger.com,1999:blog-5819005.post-78523449279103819132013-02-06T06:29:58.785-08:002013-02-06T06:29:58.785-08:00I like pass Intent created like 'new Intent(th...I like pass Intent created like 'new Intent(this, SomeActivity.class)' and pass to static method that will just add extras. With this modified intent you can call startActivity or whatever you want.sqshhttps://www.blogger.com/profile/01857448488922812964noreply@blogger.comtag:blogger.com,1999:blog-5819005.post-35829397323874458842011-06-15T05:46:37.514-07:002011-06-15T05:46:37.514-07:00This is exactly the kind of practice promoted by E...This is exactly the kind of practice promoted by Effective Java, using the compiler to avoid mistakes, and I think it works well.Davidhttps://www.blogger.com/profile/12484949555480553763noreply@blogger.comtag:blogger.com,1999:blog-5819005.post-146331899017359312011-02-11T17:13:19.278-08:002011-02-11T17:13:19.278-08:00Smart idea!Smart idea!Abel Ferreirahttps://www.blogger.com/profile/04377399832963736871noreply@blogger.com