First, edit attrs.xml to include the name: <attr name="undo_icon"
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="undo_icon" format="reference" />
</resources>
Then, edit the styles.xml to define the style: <item name="undo_icon">
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppThemeLight" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="undo_icon">@drawable/halo_dark_content_undo</item>
</style>
<style name="AppThemeDark" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="undo_icon">@drawable/halo_light_content_undo</item>
</style>
</resources>
Finally, define the menu.xml: android:icon="?undo_icon"
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_undo"
android:icon="?undo_icon"
android:title="Undo"
android:titleCondensed="Undo">
</item>
</menu>
In the Manifest: android:theme="@style/AppThemeLight" > OR switch dynamically via Context.setTheme
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppThemeLight" >
To reference in code:
TypedValue typedValue = new TypedValue();
getTheme().resolveAttribute(R.attr.undo_icon, typedValue, true);
btnUndo.setImageResource(typedValue.resourceId);
Friday, August 29, 2014
Thursday, August 28, 2014
How to fix Android SDK Content Loader stuck at 0% in Eclipse
Have you encountered the case where Eclipse hangs upon startup, in
particular when you are developing an Android applications with Android
SDK?
When that happens you see "Android SDK Content Loader" stuck at 0% in the bottom right hand of the Eclipse status bar.
There are four things you can try...
Go to your workspace directory
When that happens you see "Android SDK Content Loader" stuck at 0% in the bottom right hand of the Eclipse status bar.
There are four things you can try...
Solution 1:
Solution 2: (Works best for me, and likely the safest)
Solution 3:
Solution 4: (Most drastic, and one I have not tried)- Make sure that eclipse is not active. If it is active kill eclipse from the processes tab of the task manager
- Check if the adb process is running. If so, kill the adb process, and restart Eclipse.
Solution 2: (Works best for me, and likely the safest)
- Make sure that eclipse is not active. If it is active kill eclipse from the processes tab of the task manager
- From the command line run: C:\eclipse\eclipse.exe -clean
Solution 3:
- Make sure that eclipse is not active. If it is active kill eclipse from the processes tab of the task manager
- Open %USERPROFILE%/ (You can locate this folder from desktop) (or paste it into Explorer on windows)
- Go to .android folder (This may be a hidden folder)
- Delete the folder "cache" which is located inside .android folder
- Delete the file ddms.cfg which is located inside .android folder
- Start Eclipse
Go to your workspace directory
\workspace\.metadata\.plugins\org.eclipse.core.resources\\.projects- Copy
.projectsfolder to make a temporary backup. - Now Delete
.projectsfolder from workspace directory. (you will not loose your projects) - Start Eclipse and wait for all progress ends at right/bottom corner. Once completed all processes, shutdown Eclipse.
- Paste
.projectsfolder which you have backup earlier to\workspace\.metadata\.plugins\org.eclipse.core.resources\directory. Overwrite existing.projectsfolder. - Start Eclipse again. And all will work.
Good Luck
Wednesday, July 2, 2014
NetBeans RCP installer version upgrade
So every other installation package I've ever used, allows you to upgrade your application, by changing its version number.
Not so with the NetBeans packager.
The NetBeans platform installer uses common code located in
Customizing these files and sources allows you to brand you installer, which is all nice, but you would not expect to have to customize these files in order to get your program to upgrade.
Product version is controlled in two files, both which need to be changed.
Stupid, but there you have it. Some day, when I have time, I'll try and automate it all.
Not so with the NetBeans packager.
The NetBeans platform installer uses common code located in
{nbdir}\harness\nbi\stubCustomizing these files and sources allows you to brand you installer, which is all nice, but you would not expect to have to customize these files in order to get your program to upgrade.
Product version is controlled in two files, both which need to be changed.
product.versionin{nbdir}\harness\nbi\stub\ext\infra\build\products\helloworld\build.propertiesversionattribute increate-bundle > componentin{nbdir}\harness\nbi\stub\build.xml
Stupid, but there you have it. Some day, when I have time, I'll try and automate it all.
Tuesday, May 27, 2014
ERROR_NOT_MARKET_MANAGED in com.google.android.vending.licensing
So, after spending more than a day scratching my head over the fact that I constantly got the error code: ERROR_NOT_MARKET_MANAGED returned via my callback in the Google licensing API, the solution, as it usually does, turned out to be a simple answer.
Regardless of the fact that all Googles developer documentation tells you it's good enough to upload your APK to the product page for license testing to work, this is not true.
To get it to work, you need to publish you app. At first thought, I was afraid this would make it "live", but as long as your APK is in the Alpha or Beta Testing section, you'll be ok.
Regardless of the fact that all Googles developer documentation tells you it's good enough to upload your APK to the product page for license testing to work, this is not true.
To get it to work, you need to publish you app. At first thought, I was afraid this would make it "live", but as long as your APK is in the Alpha or Beta Testing section, you'll be ok.
Labels:
Android,
Android Development
Location:
Kanata, Ottawa, ON, Canada
Thursday, May 22, 2014
My first post
My first post, how very exciting!
I'm writing this blog mostly so I can remember various coding gotcha's that I've run into. Hopefully someone else will use this blog to avoid them.
I'm writing this blog mostly so I can remember various coding gotcha's that I've run into. Hopefully someone else will use this blog to avoid them.
Subscribe to:
Posts (Atom)