last day (15 days later) » 

10:22 PM
0
A: capture a photo from camera and display it in image view in another activity

Anton KazakovUtils Class. public static File getOutputMediaFile(int type) { File mediaStorageDir = new File( Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), Config.IMAGE_DIRECTORY_NAME); if (!mediaStorageDir.exists()) { ...

 
Cannot resolve symbol Singleton !!
 
@G.Al create singleton class with context or move these methods to your acitivty
 
sorry about not mentioning earlier,but it gives me an error also at IMAGE_DiRECTORY_NAME and MEDIA_TYPE_IMAGE
 
@G.Al public static final int MEDIA_TYPE_IMAGE = 1; public static final String IMAGE_DIRECTORY_NAME = "OwoCar"; just define these variables
 
I don't know. It's not working,there are a lot of errors..maybe you have a simpler solution.
 
10:22 PM
@G.Al i'll answer you later if you won't't find solution before. Actually this is working code just some problems with classes distribution i think
 
Okay,if you find something please help me :) I don't know what to do. I feel like I tried everything
 
hey
whats the roblem
this code works)
i use it in all my apps
 
I get an error for MEDIA_TYPE_IMAGE even after declaring them
and for IMAGE_DIRECTORY_NAME
 
what is the error
did u declared them in coffin file?)
config
if no make them non static
if u init them in activity
 
where should I put the first code. ?
 
10:29 PM
create class Utils
 
and then what should I do for AppSingleton and Media_TYPE_IMAGE and IMAGE_DIRECTORY_NAME errors ?
 
public class AppSingleton extends Application{

public static AppSingleton applicationSingleton;

public AppSingleton() {}

@Override
public void onCreate(){
super.onCreate();
applicationSingleton=this;

}


public static AppSingleton getContext() {
return applicationSingleton;
}


}

}
create this class
Media_TYPE_IMAGE and IMAGE_DIRECTORY_NAME errors ?
create class Config
and ut values i gave to you into it
 
Now I get an error in getContext()....Non-static methods cannot be referenced from a static context -.-
 
where
 
for example here : File filesDir = AppSingleton.getContext().getFilesDir();
 
10:42 PM
u didn't created class utils
 
I'm sorry .. Can I ask you something else ? I tried something new,but after i capture a photo,it doesn't display it in new activity,but it sends me to the first activity..
Bitmap bm = (Bitmap)data.getExtras().get("data");
File outFile = new File(Environment.getExternalStorageDirectory(),"myname.jpeg");
try {
FileOutputStream fos = new FileOutputStream(outFile);
if (bm != null) {
bm.compress(Bitmap.CompressFormat.JPEG,100,fos);
}
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
firstactivity.class
ooooo I forgot intent -.- sorry
 
everything fine?)
 
I was trying something new :) Sorry,I'm new to android programming and I don't understand your code,that's why I'm stuck...
Can I ask you something ?
 
10:58 PM
ofc
 
This is my firstactivity
Bitmap bm = (Bitmap)data.getExtras().get("data");
File outFile = new File(Environment.getExternalStorageDirectory(),"myname.jpeg");
try {
FileOutputStream fos = new FileOutputStream(outFile);
if (bm != null) {
bm.compress(Bitmap.CompressFormat.JPEG,100,fos);
}
fos.flush();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
Intent intent = new Intent(this,ShowCameraPhotoActivity.class);
intent.putExtra("myname.jpeg",outFile);
startActivity(intent);
this is my secondactivity
File file = new File(Environment.getExternalStorageDirectory(),"myname.jpeg");
Bitmap bm = BitmapFactory.decodeFile(file.getAbsolutePath());
if (showPhoto != null) {
showPhoto.setImageBitmap(bm);
}
I take a picture from camera,but it sends to my first activity...it doesn't show the photo in new activity...what is wrong..?
 
show my screen or put code into pastebin
i can't read this one without formatting
 
I don't know how..its my first time here in chat
 
can you answer one other question .. ? it's like my last thing,and I finish my project... stackoverflow.com/questions/39522286/…
 
11:08 PM
this question requires testing
i can help you tomorrow
but let finish this one
is everything okjaty?
okay*?
 
android doesn't show me the new changes in my device -.- it's like a bug or something from google..I'm trying to fix it
android studi
Bitmap bm = (Bitmap)data.getExtras().get("data");
File outFile = new File(Environment.getExternalStorageDirectory(),"myname.jpeg");
try {
FileOutputStream fos = new FileOutputStream(outFile);
if (bm != null) {
bm.compress(Bitmap.CompressFormat.JPEG,100,fos);
}
fos.flush();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
Intent intent = new Intent(this,ShowCameraPhotoActivity.class);
intent.putExtra("myname.jpeg",outFile);
startActivity(intent);
that's my firstactivity
File file = new File(Environment.getExternalStorageDirectory(),"myname.jpeg");
Bitmap bm = BitmapFactory.decodeFile(file.getAbsolutePath());
if (showPhoto != null) {
showPhoto.setImageBitmap(bm);
}
thats my second activity
 

last day (15 days later) »