Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 834279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:38:56+00:00 2026-05-15T04:38:56+00:00

I have this Code to Capture a image and Display it back in ListView

  • 0

I have this Code to Capture a image and Display it back in ListView
onclick of the listitem i can capture image and save to image View, but how can get onlthe left of the list item?

         public class ShootList extends ListActivity implements OnItemClickListener {
  String[] listItems = {"HeadShot", "BodyShot ", "ExtraShot", "Video Take1", "Video    Take2", "Video Take3", }; 
 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.list);
        setListAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_1, listItems));
        ListView shot = getListView();
        shot.setOnItemClickListener(this);
         

 }
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int Position, long arg3) {
    // TODO Auto-generated method stub
    
    
    int P = Position;
     

    switch ( P ) {
    case 0:
        
        Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
        startActivityForResult(intent, 1);
        break;
    case 1:
        AlertDialog.Builder alertbox1 = new AlertDialog.Builder(this);
        alertbox1.setMessage("BodyShot").show();
        break;
    case 2:
        AlertDialog.Builder alertbox2 = new AlertDialog.Builder(this);
        alertbox2.setMessage("ExtraShot").show();
        break;
    case 3:
        
        Intent Take1 = new Intent("android.media.action.VIDEO_CAPTURE");
        startActivityForResult(Take1, 0);
        break;
    case 4:
        AlertDialog.Builder alertbox4 = new AlertDialog.Builder(this);
        alertbox4.setMessage("Take2").show();
        break;
    case 5:
        AlertDialog.Builder alertbox5 = new AlertDialog.Builder(this);
        alertbox5.setMessage("Take3").show();
        break;
   
    default:
       
        break;
}
    
}
  

  public void onActivityResult(int requestCode, int resultCode, Intent data) {
         
         super.onActivityResult(requestCode, resultCode, data);
      

            int i;
                 
        // if Activity was canceled, display a Toast message

         if (resultCode == RESULT_CANCELED) {
         Toast toast = Toast.makeText(this,"camera cancelled", 10000);
         toast.show();
         return;
         }

        // lets check if we are really dealing with a picture

         if (requestCode == 1 && resultCode == RESULT_OK)
         {
         
             Bundle extras = data.getExtras();
             Bitmap b = (Bitmap) extras.get("data");
             //setContentView(R.layout.main);
           
             ImageView mImg;
             mImg = (ImageView) findViewById(R.id.img);
             mImg.setImageBitmap(b);
        // save image to gallery
         String timestamp = Long.toString(System.currentTimeMillis());
         MediaStore.Images.Media.insertImage(getContentResolver(), b, timestamp, timestamp);

         }
  }

}

alt text http://audition800.com/1.jpg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:38:56+00:00Added an answer on May 15, 2026 at 4:38 am

    NOTE: you should always include an explanation of your question, not just code.

    If you want an icon with your list item, then you need to include it in your list item’s layout xml file, which will look something like this:

    <LinearLayout
       android:layout_height="wrap_content"
       android:layout_width="fill_parent"
       android:orientation="horizontal" >
    
       <ImageView 
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
          android:id="@-id/image />
       <TextView 
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
          android:id="@-id/text" />
    </LinearLayout>
    

    Then, you will need to create a custom list adapter and override the getView() method to set the image and text fields. For all your list view needs, go here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 405k
  • Answers 405k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Does this help? /^[\p{L} ]+$/u This will match any string… May 15, 2026 at 5:54 am
  • Editorial Team
    Editorial Team added an answer In C++ there is no reason to not use it.… May 15, 2026 at 5:54 am
  • Editorial Team
    Editorial Team added an answer No magic is needed -- all perl subroutines are call-by-alias,… May 15, 2026 at 5:54 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.