Filter out contacts from contacts pick list || option to create new contact from pick list

by Riyaz » Wed, 19 Aug 2009 18:54:09 GMT


Sponsored Links
 My application wants a functionality of picking a contact from the
phone contact, I have achieved this using the following intent

Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI);
startActivityForResult(intent, 001);

I wanted few more functionalities

- An option to create a new contact from the pick list, similar to the
one which is available in inbuilt Launcher appliation

- Set of contacts should be filtered from display i.e already selected
contacts should not be displayed

- Filtering of contacts should be based on the phone number i.e a
contact might have two phone numbers associated with and wants to
filter out the phone number which is selected

I guess above can be achieved by implementing my own pick list using
contacts provider, is there any other way without implementing the new
pick list



--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Listview & Tabhost

I'm trying to figure out how to emebed a listview in a tabhost
Whenever I call

l1 = (ListView) findViewById(R.id.list);
l1.setAdapter(new ArrayAdapter<String>
(this,android.R.layout.simple_list_item_1, SITES));

it dies a rather unglamorouis death.
List is defined as
<ListView
     android:id="@+id/list"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"/>

I suspect I'm missing something rather obvious as I'm just getting
started with this, but I couldn't find other examples of people having
listviews inside tabcontrols besides the one which suggested as above.
Any suggestions?

--~--~---------~--~----~------------~-------~--~----~

2. video capture doesn't seem to work

CODEpackage com.example.android.camerarec3;

import java.io.IOException;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceView;
import android.view.SurfaceHolder;
import android.media.MediaRecorder;
import android.content.Context;
import android.content.pm.ActivityInfo;

import android.hardware.Camera;

public class CameraRec3 extends Activity implements
SurfaceHolder.Callback {
    /** Called when the activity is first created. */

        SurfaceHolder holder;
        private static final int MAX_RECORDING_DURATION_MS = 10 * 60 * 1000;
    @Override

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //sv for preview the camera video
        SurfaceView sv = (SurfaceView) findViewById
(R.id.mySurfaceView);
        holder = sv.getHolder();
        holder.addCallback(this);

        holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

        MediaRecorder recorder = new MediaRecorder();

        String filePath=("/sdcard/test.3gpp");
       // recorder.setCamera(Camera.open());
        recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);

        recorder.setVideoEncoder
(MediaRecorder.VideoEncoder.MPEG_4_SP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        recorder.setMaxDuration(MAX_RECORDING_DURATION_MS);
        recorder.setVideoSize(352,288);
        recorder.setVideoFrameRate(15);

        //we can use the getPath function to create file path
        recorder.setOutputFile(filePath);
        this.setRequestedOrientation
(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);


        try
        {
                recorder.setPreviewDisplay(holder.getSurface());
                recorder.prepare();
        }
        catch (IllegalStateException e)
        {
            Log.i(this.getClass().toString(),e.getMessage());
        }
        catch (IOException e)
        {
            Log.i(this.getClass().toString(),e.getMessage());
        }
        recorder.start();
    }
        @Override
        public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2,
int arg3) {
                // TODO Auto-generated method stub

        }
        @Override
        public void surfaceCreated(SurfaceHolder mholder) {
                // TODO Auto-generated method stub
                holder = mholder;
        }
        @Override
        public void surfaceDestroyed(SurfaceHolder mholder) {
                // TODO Auto-generated method stub
                holder=null;
        }

}









No error in LOGCAT...

--~--~---------~--~----~------------~-------~--~----~

3. GestureListener events

4. can ListActivity and Tab widget can use in one activity?

5. TextView.setMaxLines(10) is not working as what I wanted; I wanted the latest 10 lines instead of the oldest ones.

6. GridView example

7. Center an element