How can I dynamically add new icons to Android's main menu grid from Java?

What about declaring both activities in the manifest, but then enabling / disabling them as needed using PackageManager. SetComponentEnabledSetting()? Good luck Tom.

– TomTasche Jan 27 at 23:05 Tom, that's a great suggestion. I'll try that. Ideally, I'd like to add items dynamically though since I have a few use cases that I think would benefit from this, but this should hopefully work for most of what I want to do.

– Joel Jan 28 at 20:01 Nice to hear that, Joel. Please don't forget to mark this answer as correct if it's what you were looking for... – TomTasche Jan 31 at 16:49 That solution worked as long as I have the activity hard coded in the manifest. I'm going to keep looking around for options to make this dynamic, but for now, I can work with this.

– Joel Feb 2 at 7:46.

I'm not aware of a way to change that at runtime. You could either release two versions of the app, one for pre-froyo and one for after if they are sufficiently different, or check out this article on various ways to do backward compatability within a single app.

I have an application that I'd like to have multiple icons in the launcher's main menu grid but only under certain conditions. For instance, I want to show icon A and icon B but only if the phone is running Android 2.2 because icon B uses a Froyo feature, so I don't want icon B showing up if on a pre-Froyo device. Is there a way in Java to programmatically add the main menu icon?

I don't want it in the manifest file as this isn't flexible at run time... at least not as far as I am aware. This would allow me to either check for some functionality, API, user preference, or a flag in the app.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions