Looking for Stellar Android Developer/Contract in Seattle

by FlyDog » Wed, 20 Jan 2010 02:07:54 GMT


Sponsored Links
 If you're interested, please contact me. This is for a company in
downtown Seattle working.

ani...@seattletechsearch.com



Other Threads

1. Trapping onItemSelected events from an Auto complete list

I am trying to write an application with a list of items read in from
a file. This item list and the fields that go with each item are fed
into a DB. The item names are presented to the user as an auto-
completing list. Once the list item is selected, I would like to get
the value from the list and use it to query the database and display
all the detail information.

The problem I am having is trapping the event using
onItemSelectedListener and onItemSelected. Below is what I am trying.

        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

                sitedb=(new SiteListSQLiteHelper(this)).getReadableDatabase();

                model=Site.getAll(sitedb);
                startManagingCursor(model);


            sitelistArray=loadsiteArray(model);


            AutoCompleteTextView textView = (AutoCompleteTextView)
findViewById(R.id.autocomplete_site);

            ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.site_list, sitelistArray);
            textView.setAdapter(adapter);
            textView.setOnClickListener(onClick);
            textView.setOnItemSelectedListener(siteSelect);
        }

I implement the listener:

        private View.OnItemSelectedListener siteSelect=new
View.OnItemSelectedListener() {
                public void siteSelect(View v) {
// Do some interesting stuff here
                }
        };

This doesn't compile, but it has the fewest syntax errors.

Could someone tell me how to get an OnItemSelectedListener to work?
and how I grab the value selected?

-- 

2. audio record, playback working on emulator not on device

Hello,
         I am facing some issues with a sample code which works on
emulator but not on an android device. The sample code does voice
recording and then plays the same. On emulator it works fine, though
there is some delay / gap in speaking and playing. But on the device
the only thing I could hear is loud noise but not my voice.

The app has two threads, one for the UI and the other for record and
playback. Please note that the record and playback are in the same
thread.

Also I see

The code looks something like as shown below. Any suggestions about
why there is a difference in playback on emulator vs device?

Thanks in advance,
Divkis

-----------------------------------------------------------------------------
nativeSampleRate = 8000;

AudioManager am = (AudioManager)
getSystemService(Context.AUDIO_SERVICE);

int actualBufferSize = 4096*8;
int capacity = 0;

int bufferSize =      AudioTrack.getMinBufferSize(nativeSampleRate,
                        AudioFormat.CHANNEL_CONFIGURATION_MONO,
                        AudioFormat.ENCODING_PCM_16BIT);


AudioTrack atrack = new AudioTrack( AudioManager.STREAM_MUSIC,
                     nativeSampleRate,
                     AudioFormat.CHANNEL_CONFIGURATION_MONO,
                     AudioFormat.ENCODING_PCM_16BIT,
                     actualBufferSize,
                     AudioTrack.MODE_STREAM);

                capacity = AudioRecord.getMinBufferSize(nativeSampleRate,
                        AudioFormat.CHANNEL_CONFIGURATION_MONO,
                       AudioFormat.ENCODING_PCM_16BIT);


                byte[] buffer = new byte[actualBufferSize];

AudioRecord arec = new AudioRecord(MediaRecorder.AudioSource.MIC,
                        nativeSampleRate,
                        AudioFormat.CHANNEL_CONFIGURATION_MONO,
                        AudioFormat.ENCODING_PCM_16BIT,
                        actualBufferSize);

                am.setRouting(AudioManager.MODE_NORMAL,
                                        AudioManager.ROUTE_EARPIECE,
                                        AudioManager.ROUTE_ALL);
                am.setSpeakerphoneOn(true);
                am.setMicrophoneMute(false);


                Log.d("SPEAKERPHONE", "Is speakerphoneon? : " +
am.isSpeakerphoneOn());

                atrack.setPlaybackRate(nativeSampleRate);
                arec.startRecording();
                atrack.play();

                while(true == isRecording)
                {
                        int readSize = arec.read(buffer, 0, 320);
                        Log.v("Number of bytes read is ", " " + readSize);

                        int retVal = atrack.write(buffer, 0, readSize);
                }

                arec.stop();
                atrack.stop();
            }

-- 

3. What's his name?

4. Serial over Bluetooth

5. How to implement asking questions before uninstalling the apk

6. How to implement asking questions before uninstalling the apk

7. FileNotFoundException on FileOutputStream when writing on sdcard, no idea why