This project aims to provide an easy-to-use instrument for android developers to use when they need the user to select an image or video on their android phone and upload it. If the process has any errors on specific phones, these should be handled inside the library to provide the same user experience on all phones.
- Allow user to choose Photo from Gallery or Take new Photo.
- Allow user to choose Video from Gallery or Take new Video.
Android 2.2+ support
- android-image-helper-1.0.2.jar (library; contains *.class files)
- android-image-helper-1.0.2-with-sources.jar (library with sources inside; contains *.class and *.java files)
Prefer to use this JAR so you can see Java docs in Eclipse tooltips. - android-image-helper-sample-1.0.2.apk (sample application)
Latest snapshot of the library - here
- Look into How to Use
Bugs and feature requests put here.
Manual:
- Download JAR
- Put the JAR in the libs subfolder of your Android project
Here is the minimal setup needed. This could be used in an Activity, SupportActivity, Fragment, or SupportFragment.
public class ImageUploaderActivity extends Activity implements MediaEngine.ImageChooseCallback {
MediaEngine uploadEngine;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
uploadEngine = new MediaEngine.Builder(this, savedInstanceState).build();
//...
someButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
uploadEngine.performImageAsk(R.string.app_name, R.string.newphoto, R.string.oldphoto, R.string.choose, R.drawable.ic_launcher);
}
});
}
@Override
public void onSaveInstanceState(Bundle outState) {
uploadEngine.onSaveInstanceState(outState);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(uploadEngine.onActivityResult(requestCode, resultCode, data)) return;
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onCanceled(ImageUploadEngine engine) {
//notifying you that the user has canceled the request
}
@Override
public void onChosen(ImageUploadEngine engine, String path, boolean newPicture) {
//notifying you that the user has selected an image
}
@Override
public void onError(ImageUploadEngine engine, Exception ex) {
//notifying you that an error has occurred
}
}
You are allowed to use this project.
Copyright 2013 Sherif elKhatib
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.