logo
down
shadow

Using the camera activity in Android


Using the camera activity in Android

By : OttoBunge
Date : October 26 2020, 11:51 AM
Any of those help If you want to get the image back in its full glory, pass in a uri to the Intent within the EXTRA_OUTPUT extra. If you're fine with a smallish bitmap (and you should be), just call the intent as normal.
Now you have two options, deal with the uri of the image that is returned in the EXTRA_OUTPUT extra, or do the following in your onActivityResult method:
code :


Share : facebook icon twitter icon
unable to find com.android.camera.CropImage activity in android

unable to find com.android.camera.CropImage activity in android


By : Liam
Date : March 29 2020, 07:55 AM
I hope this helps . I found a way by following the LogCat while i was cropping a contact Image. It called the Intent with following parameters:
code :
cmp=com.android.gallery/com.android.camera.CropImage
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.gallery", "com.android.camera.CropImage");
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.google.android.gallery3d", "com.android.gallery3d.app.CropImage");
How to apply and save Android camera effects in camera activity?

How to apply and save Android camera effects in camera activity?


By : Carlos
Date : March 29 2020, 07:55 AM
will help you Can I apply effects on a running camera surface and save with these effects onto the SD card? , Set the parameters to whatever you want like this...
code :
            mCamera = Camera.open();
            Camera.Parameters cp = mCamera.getParameters();

            cp.setJpegQuality(100);
            cp.setColorEffect(Parameters.SCENE_MODE_PORTRAIT);
            cp.setFlashMode(Parameters.FLASH_MODE_ON);
            cp.setColorEffect(Parameters.EFFECT_MONO);
            setPictureSize(cp);

            mCamera.setParameters(cp);
I am unable to transfer the image taken from camera from one activity to another activity in android?

I am unable to transfer the image taken from camera from one activity to another activity in android?


By : M Arslan Arslan
Date : March 29 2020, 07:55 AM
hope this fix your issue I have found the answer.I am writing my two activities here.
My first activity is
code :
  import java.io.File;
  import android.app.Activity;
  import android.content.Intent;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.net.Uri;
  import android.os.Bundle;
  import android.os.Environment;
  import android.provider.MediaStore;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.ImageView;
  import android.widget.RelativeLayout;

  public class Working extends Activity{
ImageView first,second;
Button set;
Bitmap bitmap,scaled;
RelativeLayout relative;
String path;
File file;

protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(R.layout.working);
 first=(ImageView)findViewById(R.id.imageView1);
 set=(Button)findViewById(R.id.button1);                 
  set.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

      File f = new File(android.os.Environment.getExternalStorageDirectory(), "temp.jpg");

    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));

    startActivityForResult(intent, 1);
}
  });

   }

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      if (resultCode == RESULT_OK) {

            if (requestCode == 1) {

                File f = new File(Environment.getExternalStorageDirectory().toString());

                for (File temp : f.listFiles()) {

                    if (temp.getName().equals("temp.jpg")) {

                        f = temp;

                        break;

                    }

                }



                    Bitmap bitmap;

                    BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();

                    bitmapOptions.inSampleSize=2;

                    bitmap = BitmapFactory.decodeFile(f.getAbsolutePath(),

                            bitmapOptions); 



                    first.setImageBitmap(bitmap);
                    Intent i = new Intent(Working.this, Temp.class);
                    i.putExtra("imagePath" ,f.getAbsolutePath() ); 
                    startActivity(i);
      }
  }
 }
 }
import android.app.Activity;
import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.Bundle;
 import android.widget.ImageView;

 public class Temp extends Activity{
 ImageView iv;
protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(R.layout.temp);
    iv=(ImageView)findViewById(R.id.imageView1);
    BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();

    bitmapOptions.inSampleSize=6;    
    String imagePath = getIntent().getStringExtra("imagePath");

    Bitmap bitmap = BitmapFactory.decodeFile(imagePath,bitmapOptions);
    iv.setImageBitmap(bitmap);
 }
 }
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/relative" >

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:text="Button" />

<Button
    android:id="@+id/button2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/button1"
    android:layout_alignParentBottom="true"
    android:text="Button" />

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/button2"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/button1" >

    <ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:src="@drawable/ic_launcher"/>"

</RelativeLayout>

</RelativeLayout>
Android - Portrait only activity gets rotated after camera activity

Android - Portrait only activity gets rotated after camera activity


By : ricky92
Date : March 29 2020, 07:55 AM
Hope this helps Was actually caused by not handling activity recreation properly. The rotation was just a strange side effect.
Android Activity with camera

Android Activity with camera


By : FortranCoder
Date : March 29 2020, 07:55 AM
it should still fix some issue If you try to open() the camera while it is already running then you will get a RuntimeException. So maybe this will help you.
Related Posts Related Posts :
  • Java - map key lookup ignoring case
  • Jackson deserialize map null values to empty string
  • Anyone knows why setCount() is not working in twitter4j?
  • Object Visibility in a Multi-threaded Program in Java
  • Can't store and load an arraylist in an object file
  • convert a string number starts with `00` to `+` in java
  • Java - avoiding NonSuchElementException using ConcurrentLinkedDeque
  • Converting Immutable to mutable list Java
  • Getting nosuchmethod exception
  • How to get MQTT subscriptions
  • Android Google Sign in Exceptions
  • JavaFX - method that waits for user input
  • Replacing values for a particular key in treemap changes values for every key
  • This method call passes a null value for a nonnull method parameter. Either the parameter is annotated as a parameter th
  • Kafka: consume all messages on demand
  • Notify what text was changed in textview
  • Tinkerpop/Gremlin: select vertices together with outgoing edge count
  • transform a list of objects into a list of integers that pass a check
  • Why this java code is showing strange behavior?
  • Maven Project classes not compiling
  • Edit image to make text more clear opencv
  • Android Spinner nullpointer
  • Add result to int array every time you finish counting the occurrence
  • Android import java library
  • How to use LDAP Authentication in a corporate environment
  • adding item during iteration in java special usecase
  • How can I sort a map with string key? like (1 foo , 2 foo)
  • How to test an implementation of TLS based on SSLEngine?
  • Sorting a Linked List in alphabetical order
  • Can't make more than one request on java.net.http.HttpClient or will receive: javax.net.ssl.SSLHandshakeException
  • Java logic - strange things happening in while loop
  • Unable to replicate an encryption method from Java to PHP using AES/ECB/PKCS5Padding
  • How program arithmetics on general objects which become defined only later?
  • Make asynchronous call synchronous in Kotlin
  • Thread Pool with Spring @Value for Pool size doesnt run properly
  • How to substring before nth occurence of a separator?
  • Resume S3 multipart upload: PartETag
  • Mutable fields should not be "public static"
  • How to remove fragment from URI
  • Add a node in xml using java only if the node has an attribute
  • java streams: elegant way to filter according an exception is thrown
  • Exception in thread, java code wont execute properly. If/else statments
  • using the same UI instance inside access method
  • Single Linked List in reverse order Java
  • Is there a java api that will identify the ipv6 address fd00:: as local/private?
  • Clear a cache with JSR-107 annotations
  • Store data from an array for later comparison
  • Why BufferedWriter here is not writing to the file even though I close it in the end?
  • Three methods to search: name; name and surname; and age in an array
  • When do I have to create new instance while using @Autowired
  • ArrayList public constructor - "Constructs an empty list with an initial capacity of ten" - where?
  • How to make assignable, number-like class in Java?
  • How to make a query in Firebase similar to a SQL query?
  • How to inflate SupportActionBar menu from outside Activity
  • Is it good practice using two navigation (component architecture) in the same app?
  • Can a method annotation handle errors thrown by this method?
  • How does the javadoc know which method each documentation comment is for?
  • Refactoring/moving java package between intellij projects
  • Why lists pksc11-tool seven Objects but Java Keystore has Only one
  • How to update an entity with an element-collection of type Map<String,String>?
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org