I am spending my days with practicing PDF editor.
I succed in loading Pdf files. and To edit the file I am using invisible activity over the file. Of course, activity is the 'editor'.
I can write and highlight things.
but the problem is the merging of these two activity.
I have to go to menu and click 'write' button to write.
and then PDF doesn't move any more because i am on 'editor'activity.
so I have to save the writings and exit the 'write'mode.
THis is super uncomfortable....I want it to be more simple.
'especially' those 'saving' part.. I really hate it.
'move' between two activities should be more natural without saving process...
Don't you have any good idea about this?
please help me out!!!!! new beginer is crying for anwser. Thanks for your time.
You would start your editor activity and wait for the result.
Something along the lines....
void goToEditMode() {
startActivityForResult(new Intent(this, PdfEditorActivity.class), SOME_REQUEST_CODE);
}
and then wait for the result...
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == SOME_REQUEST_CODE) {
if(resultCode == RESULT_OK) {
extractData(data);
}
}
}
Assuming you passed your necessary data as an extra, implementing extractData(...) should be easy for the purpose.
Related
I am using Intent(Intent.ActionOpenDocument) and OnActivityResult() fine in my Android mobile app. (Targeting Android 10, API 29). The user selects an audio file and the app plays the file fine. Ths user is able to select a file from anywhere on their device.
I would like to display the name of the file that is playing in the UI. How do I grab the filename?
In OnActivityResult, this: ReturnedIntent.Data.Path, returns this:
/document/content://com.microsoft.skydrive.content.metadata/Drive/RID/phil%40mydomain.com/Item/RID/DC9388F99D04BA56%21369828/Property/?RefreshOption=AutoRefresh&RefreshTimeOut=15000&CostAttributionKey=11-21-1
which has nothing resembling the file name in it. I have found older stack posts on this, but they don't work for me. I have a feeling that the issue is with Android security and/or permissions that I need to give the app.
How do I grab the file name so I can display it in the UI?
Thanks #CommonsWare, you pointed me in the right direction. With the help of intellisense I noticed that the .Data property of the returned Intent was a Uri. So this is what (C# Xamarin) ended up working.
public override void OnActivityResult(int requestCode, int resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
if (resultCode == -1 && requestCode == 42)
{
Intent ReturnedIntent = data;
// the code is in a Fragment here so we use Activity for the Context
DocumentFile df = DocumentFile.fromSingleUri(Activity, ReturnedIntent.Data);
string FileName = df.Name; // that contains the filename
I never would have got this on my own. I love that Android Java and Xamarin C# are so close. Thanks again #CommonsWare.
I need a camera that allows me take multiple pictures at once and then select one. Others may or may not be stored on the device. I've tried this. I can take multiple images but how to select one and use it in my app? I read the documentation related to camera2 but its hard to understand without any practical example.I also tried these, but an isolated snippet won't help.
Any example related to the use of burst camera would help.
I do not expect a full code, but any directions on how to proceed? Is it possible to display the picture thumbnails as an when they are clicked on the camera screen itself. I'll need to have the bitmap of the image selected.
I can rephrase any part of the question if not clear.
Try this
you can Call your second startActivityForResult() from the onActivityResult() you get from your first startActivityForResult().
like this by this code you can get 10 pic
public int PIC_CODE=0;
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
// get new image here like this
if(PIC_CODE<10){
// add new requset of picture like this
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
PIC_CODE++;
}
}
You have to implement your own camera to take multiple pictures. Create a class with surface view and implements SurfaceView.Callback. Please check out my library which will implement the same.
https://github.com/SripadRaj/BurstCamera
I need a camera that allows me take multiple pictures at once and then select one. Others may or may not be stored on the device. I've tried this. I can take multiple images but how to select one and use it in my app? I read the documentation related to camera2 but its hard to understand without any practical example.I also tried these, but an isolated snippet won't help.
Any example related to the use of burst camera would help.
I do not expect a full code, but any directions on how to proceed? Is it possible to display the picture thumbnails as an when they are clicked on the camera screen itself. I'll need to have the bitmap of the image selected.
I can rephrase any part of the question if not clear.
Try this
you can Call your second startActivityForResult() from the onActivityResult() you get from your first startActivityForResult().
like this by this code you can get 10 pic
public int PIC_CODE=0;
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
// get new image here like this
if(PIC_CODE<10){
// add new requset of picture like this
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
PIC_CODE++;
}
}
You have to implement your own camera to take multiple pictures. Create a class with surface view and implements SurfaceView.Callback. Please check out my library which will implement the same.
https://github.com/SripadRaj/BurstCamera
I have implemented Aviary Photo Editor in my Android app.
I need to get the Undo/Redo and Apply events from Aviary in my App.
Please help me out.
Suggestions really gonna appreciated.
Thanks in Advance.
Paradigm for interacting with the Image Editor
The Creative SDK Image Editor (formerly Aviary) doesn't emit events for redo/undo, but the UI does allow the user to undo and redo.
The paradigm for programmatic interaction with the Image Editor is that you:
Configure the Image Editor
Launch the Image Editor and pass in an image
Receive the resulting edited image
While an image is being edited, no events are emitted to the rest of the program.
Receiving an edited image
You receive the edited image in the Activity's onActivityResult() method.
Here is a basic example:
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
switch (requestCode) {
/* Make a case for the request code we passed to startActivityForResult() */
case 1: // Can be any int
/* Show the image! */
Uri editedImageUri = data.getData();
mEditedImageView.setImageURI(editedImageUri);
break;
}
}
}
More info
You can get a sample app to fork and clone on the Creative SDK GitHub account.
Further information and documentation can be found in the Creative SDK Image Editor developer guide.
I have posted a question before and got response regarding Barcode scanning in ZXing.
Currently i have run the barcode scanner app code, that is given in the source(/android/) using this post
My objective is to scan a barcode in my app. Since zxing is open source as told by the authors, i need to customize the scanner app raw code in my app. I found many files like WifiActivity and all. I dont know whether all the files are required to scan a barcode.
Now i want to extract the necessary and required files to decode using the camera captured image. Is it possible to extract the parts? If yes, can anyone help me in doing this by referring any links or steps. Thanks for all your useful posts and great responses. Sorry for my bad english.
what exactly are you trying to achieve? Do you want to edit and enhance the ZXing Source/App or want to use this library in your App for scanning.
For scanning you could invoke the activity for the scan result like following:
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
try {
startActivityForResult(intent, REQUEST_CODE);
} catch (ActivityNotFoundException e) {
//Do something here
}
After scan u will receive the result in onActivityResult method:
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == REQUEST_CODE) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
I did something similar to this, but I only wanted the QR generation part of the zxing project. So I found the relevant call (maybe something like Bitmap b = zx.genQRCode() or whatever) and copied that java file into my project.
Compile and BAM - you get a ton of compile errors. At the point you just start copying other referenced files into your project until you don't get any more compile errors.
Don't forget to include proper attribution in your app - see this FAQ.