Tuesday, June 14, 2011

Android: Mediaplayer prepare() method crashes.

If you tried to run voice recording with code from android developer site, you might have encountered this problem  -   prepare() method crashes. If you read logcat you can see that it is because of file permission problems. Device drive fails to create the file mentioned in the code.

Here is the work around:

Audio record is using a file that is not on the driver yet. So create a file named audio.3gp in your local file system. File can be empty.
On eclipse, open DDMS by Window> open perspective > DDMS
Open window > show view > File Explorer
Select data > local > temp
Click on 'push a file onto folder' button on the right top corner to bring up file select dialog.
Select audio.3gp  created in the local file system. It will be added to data > local > temp in the device.

Change name of the file in code to "data/local/tmp/audio.3gp"
Now device driver can see the file and your project should run fine.

Monday, May 30, 2011

Andriod Emulator - Trouble shooting

Problem:

When I use MapActivity, I can see grid of the map and zoom controls. But I cannot see the map.

Causes:
1. You have not set up mapkey in xml file properly. Check this to find out how.
or
2. Your map does not have a default location to show. Set up default location as follows:
On windows command line, type
telnet localhost 5554
geo fix -120.62 35.29
This will set a location for map to show.

or
3. You do not have internet connection




I cleaned up build and I cannot find R.java anymore

Causes:
There should be some error in one of the xml files. Correct it. Once xml files are correct, building project  will create R.java automatically.

How can I find logcat on Android emulator 
Open DDMS by
Go to windows > Open Perspective > DDMS

Then open logcat by
Window > Show view > logcat

Emulator is taking the whole screen. How can I resize emulator

Go to Window> Android SDK and AVD Manager
Select emulator and click on edit.
Enter width and height at Resolution fields under Skin to set new resolution.



Friday, May 27, 2011

Android error: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/....').

I have been getting this error and I could not figure out what is the problem. Finally figured out the reason.

This error means that R.java does not have a reference to the image file in question.
Check R.java under gen folder and find out  if it has a location reference to the image file you added.  If it does not, these are the possible reasons.

1. You forgot to add image file to res drawable folder
2. You added image file to a wrong drawable folder. There are three drawable directories, namely
drawable-hdpi, drawable-ldpi, drawable-mdpi. Try to add image to all three directories and one of them will work depending on the resolution size of your image.


3.  You have another file in the folder with the same name. Rename one of them so that there are no name conflicts.










Tuesday, April 19, 2011

Rational Functional Tester- isEnabled() method on buttons throws exception.




Problem: When using isEnabled method on a button disabled already throws ObjectNotFound exception.


Solution: Use buttonname(null,DISABLED).isEnabled() instead of buttonname().isEnabled()

Sunday, March 20, 2011

SMTP trouble shooting : error 500 5.5.1 "Command unrecognized"

I am able to set up connection with mail server .I get response from mail server while sending HELO message. But I get error 500 5.5.1 Command unrecognized""  when I send all other messages. I am sure it is not syntax error that causing the problem.

Solution :


Try appending your messages with carriage return and line feed.
Example,

 "HELO mailserver_name\r\n";
"MAIL FROM:\r\n";
"RCPT TO:\r\n" 


In SMTP, error messages starting with 500 is due to syntax errors in messages sent. Focus on the message you are sending while you are debugging.If that does not work, using telnet, try to send the same messages and make sure that mail server responds correctly. Refer RFC 821 for further reference.

REPLY CODES BY FUNCTION GROUPS

500 Syntax error, command unrecognized
[This may include errors such as command line too long]
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented

211 System status, or system help reply
214 Help message
[Information on how to use the receiver or the meaning of a
particular non-standard command; this reply is useful only
to the human user]

220 Service ready
221 Service closing transmission channel
421 Service not available,
closing transmission channel
[This may be a reply to any command if the service knows it
must shut down]

250 Requested mail action okay, completed
251 User not local; will forward to
450 Requested mail action not taken: mailbox unavailable
[E.g., mailbox busy]
550 Requested action not taken: mailbox unavailable
[E.g., mailbox not found, no access]
451 Requested action aborted: error in processing
551 User not local; please try
452 Requested action not taken: insufficient system storage
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
[E.g., mailbox syntax incorrect]
354 Start mail input; end with .
554 Transaction failed

Saturday, February 12, 2011

How to set environmental variables in windows XP

Note: Following procedures set system environmental variables permanently. For temporary settings use 'set name=value' in command line.

Option 1

Right click on My Computer.
Select properties.
Click on Advanced tab
Click on Environmental variables
Click on new under system variables
Enter name and value of environmental variable
Click ok.

Option 2

Click on Start > Control Panel > System
A window opens.
Click on Advanced tab
Click on Environmental variables
Click on new under system variables
Enter name and value of environmental variable
Click ok.