Mock Location Provider [SOLVED]

by Justin (Google Employee) » Wed, 03 Sep 2008 07:54:40 GMT

Sponsored Links
 I just posted some code at 

Other Threads

1. How to dynamically add views to custom layout based on size

I have created a custom GameBoard class which derives from
TableLayout.  I have also a created custom GamePiece class to be
placed on this game board that derive from ImageView.  My goal is to
measure the size of the GameBoard and dynamically add a variable
number GamePieces based on the size of the GameBoard.

To accomplish this, I have overridden onSizeChanged in GameBoard to
determine the size of the board and I calculate how many GamePieces to
place based on this width and height.  I have log messages that output
whenever a GamePiece is added to the GameBoard (via addView).  Though
I can see the messages coming through, I never see the GamePieces.

I have found through testing that I can place a fixed number of
GamePieces (which are visible) on the GameBoard in the GameBoard's
constructor, but I cannot know it's dimension at that time.

I have also tried adding the GamePieces in the onLayout method, but
get the same results as onSizeChanged.

What is the correct method for determining the size of my GameBoard
and placing a variable number of GamePieces based on that size?

Thanks in advance,


2. Trouble getting location to recorded audio


I have to following code to launch and the audio recorder on Android:

final Intent recordSoundIntent = new Intent
String fileName = Environment.getExternalStorageDirectory() +
File.separator + UUID.randomUUID() + ".3gpp";
recordSoundIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new
getString(R.string.record_sound_chooser)), INTENT_SOUND_RECORDING);

And the following code to save the location to the newly recorded

Uri uri = data.getData():

And this code to play (it works with no problem):

MediaPlayer mp = new MediaPlayer();

My problem is the following:

1. My filename (fileName) has no effect, the Uri returned from
data.getData() returns in my last test run: 
However, this file is created on my sdcard: recording34485.3gpp. If it
is not possible to set custom location upon creating sound it is the
location to this file I would like.

2. I want to mail this recording using the ACTION_SEND, but I can't
attach the audio file, I guess because soundRecording.getLocation()
points to content://media/external/audio/media/41 and not
File file = new File(soundRecording.getLocation());
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));

Can anyone help me?

Best regards



3. Is it possible to use an upgraded version of Webkit?

4. Which Reference System is used by the Google Maps Api

5. why is my app asking to access phone calls and storage?

6. How to get the highest API level supported by the device?

7. Using the new startForeground vs the old setForground for services