1. Download our Official Android App: Forums for Android!

Apps Im trying to use my HTC camera on my pc Eclipse but im getting errors:

Discussion in 'Android Development' started by Chocolade, Jan 19, 2013.

  1. Chocolade

    Chocolade Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    8
    Joined:
    Aug 7, 2011

    Aug 7, 2011
    8
    0
    5
    This is the content of the file: MainActivity.xml
    Code (Text):
    1. package com.example.camera_test;import android.os.Bundle;import android.annotation.SuppressLint;import android.app.Activity;import android.content.Intent;import android.hardware.Camera;import android.view.Menu;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.ImageView;import android.widget.TextView;public class MainActivity extends Activity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        Button button = (Button) findViewById(R.id.button1);        button.setOnClickListener(new OnClickListener()        {        @SuppressLint("NewApi") @Override        public void onClick(View arg0) {            // TODO Auto-generated method stub            Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );            int i = Camera.getNumberOfCameras();            TextView age = (TextView) findViewById(R.id.textView1);            age.setText(i);            startActivityForResult( intent, 0 );        }        });    }    @Override    public boolean onCreateOptionsMenu(Menu menu) {        // Inflate the menu; this adds items to the action bar if it is present.        getMenuInflater().inflate(R.menu.activity_main, menu);        return true;    }}
    It was working good I clicked the button and it opened the camera application on my device ! But as soon as I added this lines:
    int i = Camera.getNumberOfCameras(); TextView age = (TextView) findViewById(R.id.textView1); age.setText(i);Im getting the error on my device say nned to force close.
    I tried also instead age.setText(I); this:
    age.setText(Integer.toString(i));I tried instead of id.textView1 also id.button1 but not working.
    This is the content of activity_main.xml file:
    Code (Text):
    1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity" >    <TextView        android:id="@+id/textView1"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_centerHorizontal="true"        android:layout_centerVertical="true"        android:text="@string/hello_world" />    <Button        android:id="@+id/button1"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentRight="true"        android:layout_alignParentTop="true"        android:layout_marginRight="45dp"        android:layout_marginTop="62dp"        android:text="Activate The Camera" /></RelativeLayout>
    This is the only two files I did changes.

    I can make I did that on button click it will open the camera application on my device ! but I can't find how to show a message also when I click the button that will show how many cameras I have on the device. Im getting on my device when clicking the button an error say need to force close it if I move this 3 lines of the numberofcameras it will work good again.
     

    Advertisement

  2. Chocolade

    Chocolade Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    8
    Joined:
    Aug 7, 2011

    Aug 7, 2011
    8
    0
    5
    What im trying to do now is to take a photo with the camera of my device and it will show the camera on a small window. ( Changed my code a bit from the main question thread the above message but getting same error).
    But again im getting on my device right after taking a shot and then clicking DONE the error that it need to force close the application.

    I mean I click on the button Activate The Camera a button I have in the designer.
    And it does open the camera application on my device.

    Then I click to take a photo then I click on Done then it throw the error that it need to be force close.

    Code (Text):
    1.  
    2.  
    3. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]package
    4. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]com.example.camera_test;[/SIZE]
    5.  
    6. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    7. [/LEFT]
    8. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][U]android.os.Build[/U];[/SIZE]
    9. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    10. [/LEFT]
    11. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.os.Bundle;[/SIZE]
    12. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    13. [/LEFT]
    14. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.annotation.SuppressLint;[/SIZE]
    15. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    16. [/LEFT]
    17. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.app.Activity;[/SIZE]
    18. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    19. [/LEFT]
    20. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.content.Intent;[/SIZE]
    21. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    22. [/LEFT]
    23. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.graphics.Bitmap;[/SIZE]
    24. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    25. [/LEFT]
    26. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][U]android.hardware.Camera[/U];[/SIZE]
    27. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    28. [/LEFT]
    29. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.view.Menu;[/SIZE]
    30. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    31. [/LEFT]
    32. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.view.View;[/SIZE]
    33. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    34. [/LEFT]
    35. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.view.View.OnClickListener;[/SIZE]
    36. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    37. [/LEFT]
    38. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.widget.Button;[/SIZE]
    39. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    40. [/LEFT]
    41. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.widget.ImageView;[/SIZE]
    42. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    43. [/LEFT]
    44. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][U]android.widget.TextView[/U];[/SIZE]
    45.  
    46. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/LEFT]
    47. [/LEFT]
    48. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] MainActivity [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Activity {[/SIZE]
    49.  
    50. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CAMERA_PIC_REQUEST[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = 1337; [/SIZE]
    51. [SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#646464]
    52. [/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]protected[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onCreate(Bundle savedInstanceState) {[/SIZE]
    53. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2].onCreate(savedInstanceState);[/SIZE]
    54. [SIZE=2]setContentView(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]activity_main[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
    55. [SIZE=2]Button button = (Button) findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]button1[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]
    56.  
    57. [LEFT][SIZE=2]button.setOnClickListener([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] OnClickListener()[/SIZE]
    58. [SIZE=2]{[/SIZE]
    59. [SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@SuppressLint[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"NewApi"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) [/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#646464]
    60. [/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onClick(View arg0) {[/SIZE]
    61. [SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f9fbf][SIZE=2][COLOR=#7f9fbf]TODO[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] Auto-generated method stub[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
    62. [/COLOR][/SIZE][SIZE=2]Intent intent = [/LEFT]
    63. [/LEFT]
    64. [/SIZE][LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Intent(android.provider.MediaStore.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]ACTION_IMAGE_CAPTURE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] );[/SIZE]
    65.  
    66. [LEFT][SIZE=2]startActivityForResult( intent, [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CAMERA_PIC_REQUEST[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] );[/SIZE]
    67. [SIZE=2]}[/SIZE]
    68. [SIZE=2]});[/SIZE][/LEFT]
    69.  
    70.  
    71. [LEFT][SIZE=2]}[/SIZE][/LEFT]
    72.  
    73. [LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#646464]
    74. [/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]boolean[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onCreateOptionsMenu(Menu menu) {[/SIZE]
    75. [SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Inflate the menu; this adds items to the action bar if it is present.[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
    76. [/COLOR][/SIZE][SIZE=2]getMenuInflater().inflate(R.menu.[/LEFT]
    77. [/LEFT]
    78. [/SIZE][LEFT][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]activity_main[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], menu);[/SIZE]
    79. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
    80. [SIZE=2]}[/SIZE]
    81. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]protected[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onActivityResult([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] requestCode, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] resultCode, Intent data) { [/SIZE]
    82. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (requestCode == [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CAMERA_PIC_REQUEST[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]) { [/SIZE]
    83. [SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// do something[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
    84. [/COLOR][/SIZE][SIZE=2]Bitmap thumbnail = (Bitmap) data.getExtras().get([/LEFT]
    85. [/LEFT]
    86. [/SIZE][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"data"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
    87. [LEFT][SIZE=2]ImageView image = (ImageView) findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]menu_settings[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
    88. [SIZE=2]image.setImageBitmap(thumbnail);[/SIZE]
    89. [SIZE=2]} [/SIZE]
    90. [SIZE=2]} [/SIZE]
    91. [SIZE=2]}[/SIZE][/LEFT]
    92. [/LEFT]
    93.  

    And this is the content of the file activity_main.xml:

    Code (Text):
    1. <


    Code (Text):
    1. [SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]RelativeLayout[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]xmlns:android[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://schemas.android.com/apk/res/android"[/COLOR][/SIZE][/COLOR][/SIZE][/I]
    Code (Text):
    1. [SIZE=2][COLOR=#2a00ff]
    2.  
    3. [/COLOR][/SIZE][LEFT][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]xmlns:tools[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://schemas.android.com/tools"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    4. [LEFT][/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"match_parent"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    5. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"match_parent"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    6. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]tools:context[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]".MainActivity"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][/LEFT]
    7. [/COLOR][/SIZE]
    8. [LEFT][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]TextView[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f]
    9. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/textView1"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    10. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    11. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    12. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_centerHorizontal[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"true"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    13. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_centerVertical[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"true"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    14. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:text[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@string/hello_world"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][/LEFT]
    15. [/COLOR][/SIZE]
    16. [LEFT][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]Button[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f]
    17. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/button1"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    18. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    19. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    20. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_alignParentRight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"true"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    21. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_alignParentTop[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"true"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    22. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_marginRight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"45dp"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    23. [/COLOR][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_marginTop[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"62dp"[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2][COLOR=#2a00ff]
    24. [/COLOR][/SIZE][U][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:text[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Activate The Camera"[/COLOR][/SIZE][/COLOR][/SIZE][/I][/U][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][/LEFT]
    25. [SIZE=2][COLOR=#008080]</[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]RelativeLayout[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/COLOR][/SIZE][/COLOR][/SIZE]
    I don't understand why it throw this error on my device and not showing the image I took.



    [/LEFT]
     
  3. Chocolade

    Chocolade Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    8
    Joined:
    Aug 7, 2011

    Aug 7, 2011
    8
    0
    5
    Found how to do it. Added ImageView in my activity_main.xml:

    <​
    ImageView

    android:id="@+id/imageView1"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:src="@drawable/ic_launcher" />

    Then in the MainActivity.java file I changed id.imageView1

    Thanks.
     

Share This Page

Loading...