Showing posts with label maintenance. Show all posts
Showing posts with label maintenance. Show all posts

2014-02-27

Level Up - Android Dev: How To Automatically Extract Hardcoded Strings To res/values/strings.xml

This is just one of the many refactoring features of Eclipse. Using this extract feature, you won't even need to open res/values/strings.xml to add the String resources nor manually write out reference to the resource.

This saves a lot of time, and allows the best practice of putting String constants away from the UI/Java files so that localization can be performed easier. This method I'm about to show you is especially productive because it can change all instances of that particular String to point to the xml string resource so that you don't have to do it individually one-by-one. (I'm doing maintenance on code that has everything hardcoded, so this is a lifesaver.)

To automatically extract the String, it's easy enough:

Step 1: Highlight the entire String that you would like extracted and sent to res/values*/strings.xml
Step 2: From the menu bar, select Refactor->Android->"Extract Android String..."
Step 3: Preview options and confirm changes.

Step 2: Automatically extracting string menu option.


Step 3: Many different great refactoring options to choose from.


This works in the XML and Java files for your Android application. And, this is much quicker than manually changing all instances of hardcoded Strings to getString() and @string/.


~ Danial Goodwin ~



2013-12-15

Error: The Windows Phone Emulator wasn't able to ensure the virtual machine was running

Here's just another problem that I experienced while trying to create a Windows Phone app. It didn't come up last night for my last app. So, I figured out that I was running too many things at once for my 4GB RAM laptop. Or, should I say, Windows was running too many things? The one differentiating factor between last night and tonight was that tonight there was a "Windows Maintenance in progress". But, it wasn't too bad. I just closed out every other program I had open, including the Dropbox sync and I was able to continue opening the Windows Phone WXGA emulator so that I could take screenshots for the store.

Here's the full error report:
[Window Title]Windows Phone Emulator 
[Content]The Windows Phone Emulator wasn't able to ensure the virtual machine was running:
Something happened while starting a virtual machine: 'Emulator WXGA.danial' could not initialize. (Virtual machine ID C3F3456A-1234-ASDF-87GH-ABD23456GG90)
Not enough memory in the system to start the virtual machine Emulator WXGA.danial with ram size 1024 megabytes. (Virtual machine ID C3F3456A-1234-ASDF-87GH-ABD23456GG90)
[Close]

~ Danial Goodwin ~