Summery of problem:- I have classes named AttachPicture which extends the ListActivity and another class MyArrayAdapter which extends the ArrayAdapter.With the help of these classes i am able to create a ListView in which i have two textviews and a button in each item.ListView is working fine no problem till here.But now i want to start the camera on click of button presents in every item of listview, here’s my problem starts give me any idea and explain it with code to get the expected result.
Here’s my code which i m putting inside the
onClick(){
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
}
But eclipse is not allowing my app to put startActivityForResult(cameraIntent,CAMERA_PIC_REQUEST); I dont know why it is happening.Help me to get rid of this problem.
Thanx in advance.
write
button.onClickListener(){
//code for camera intent
}
inside
getView()overridden method of Adapter;in case arrayAdapter does not provide getView(view, position , … ) extend base Adapter .
Editing
startActivtyForResult()is method of activity class , so pass Activity context to Adpter , then callcontext.startActivtyForResult()