(Mobile App Development) In Android Studio, Create a camera app that allows the
ID: 3918830 • Letter: #
Question
(Mobile App Development)
In Android Studio, Create a camera app that allows the user to upload a picture from their phone camera gallery, see the picture via summary page, and edit the picture as well. Clicking on "Insert picture here from camera photo gallery" in the add page will allow the user to upload a picture from their existing camera photo gallery on their phone. The user can choose where to save the picture, starting with Picture 1-5. Once they choose where to save the picture from, they can view that picture in the summary page. In the summary page, the user can see the picture that they uploaded. They can also change or edit the picture that they uploaded using the Edit button from the Summary Page. Clicking on the Edit Button will take you to the Edit page, where the user can click and edit on the Image View from Picture 1-5 and change the picture. Once they hit the "done" button in the Edit page, it will update the new photo added in the Summary Page.
Notes:
1. Make the application according to the requirement. .
2. Do not screenshot, do not write this on paper. Please copy and paste source codes on Chegg.
3. Please post all codes from both XML and Java codes. If there are any changes in Manifest or values codes, post those as well.
4. If there are specific instructions like how to get the home icon, please describe it in the solution.
5. Screen shot the output, NOT the codes of the camera app.
INSERT PICTURE HERE FROM Camera photo gallery Clicking on this box allows you to add a picture from your camera photo gallery) Choose where to save Picture in. Picture I Picture 2 ?? Picture 3 Picture 4 scroll Picture 5 ADD PICTURE Add PageExplanation / Answer
activity_main.xml
<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" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/camera_button"
android:id="@+id/btnCamera"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/button"
android:textColor="#ffd3ffe5"
android:textStyle="bold" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/capturedImage"
android:layout_above="@+id/btnCamera">
</ImageView>
</RelativeLayout>
strings.xml
<string name="camera_button"> Take Picture</string>
button.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/button_pressed"
android:state_pressed="true" />
<item android:drawable="@color/button_pressed"
android:state_focused="true" />
<item android:drawable="@color/button_normal" />
</selector>
MainActivity.Java
ackage net.simplifiedcoding.androidcameraapp;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.GridLayout;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TableLayout;
public class MainActivity extends ActionBarActivity {
private Button btnCamera;
private ImageView capturedImage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Typeface font = Typeface.createFromAsset( getAssets(), "fontawesome-webfont.ttf" );
btnCamera = (Button) findViewById(R.id.btnCamera);
capturedImage= (ImageView) findViewById(R.id.capturedImage);
btnCamera.setTypeface(font);
btnCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openCamera();
}
});
}
private void openCamera() {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == RESULT_OK) {
Bitmap bp = (Bitmap) data.getExtras().get("data");
capturedImage.setImageBitmap(bp);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.