Comments (5)
As the exception says:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.Application android.app.Activity.getApplication()' on a null object reference
at com.nuro.messaging.ChatFragment.sendMessage(ChatFragment.java:479)
at com.nuro.messaging.ChatFragment.access$500(ChatFragment.java:63)
at com.nuro.messaging.ChatFragment$11.onCompleted(ChatFragment.java:648)
at com.alexbbb.uploadservice.AbstractUploadServiceReceiver.onReceive(AbstractUploadServiceReceiver.java:38)
You're invoking a method on a null object in your custom implementation of AbstractUploadServiceReceiver's onCompleted method. Debug your code.
from android-upload-service.
Hi Alex,
Thank, i'm noob programmer :) working on my skills. but thank you for best
support.
Idan
On Mon, Mar 9, 2015 at 3:36 PM, Alex Gotev [email protected] wrote:
As the exception says:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.Application android.app.Activity.getApplication()' on a null object reference
at com.nuro.messaging.ChatFragment.sendMessage(ChatFragment.java:479)You're invoking a method on a null object in your custom implementation of
AbstractUploadServiceReceiver's onReceive method. Debug your code.Reply to this email directly or view it on GitHub
#24 (comment)
.
Idan Ayalon
from android-upload-service.
@idanbar134 keep working like you do :) I suggest you to learn how to read Java Stack Trace, as it's your "best friend" to find out what's going wrong in some cases. Sorry to bother you with this ticket you opened: #22 again, but I need to know if you still have the described problem or how you managed to solve it :)
from android-upload-service.
Thanks. I learn the hard way :) and I solved it.
On Mar 9, 2015 4:54 PM, "Alex Gotev" [email protected] wrote:
@idanbar134 https://github.com/idanbar134 keep working like you do :) I
suggest you to learn how to read Java Stack Trace, as it's your "best
friend" to find out what's going wrong in some cases. Sorry to bother you
with this ticket you opened: #22
#22 again, but
I need to know if you still have the described problem or how you managed
to solve it :)Reply to this email directly or view it on GitHub
#24 (comment)
.
from android-upload-service.
Hi Alex,
I'm trying to upload a photo that i pick from the gallery using this code:
public String getPath(Uri uri) {
// just some safety built in
if( uri == null ) {
return null;
}
// try to retrieve the image from the media store first
// this will only work for images selected from gallery
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = getActivity().getContentResolver().query(uri,
projection, null, null, null);
if( cursor != null ){
int column_index =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
// this is our fallback here
return uri.getPath();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);
String realPath = "";
if (resultCode == Activity.RESULT_OK ) {
if( requestCode == REQUEST_CAPTURE_PICTURE ){
file = new
File(Environment.getExternalStorageDirectory().toString());
for (File temp : file.listFiles()) {
if (temp.getName().equals("temp.jpg")) {
file = temp;
realPath = file.toString();
break;
}
}
}
if (requestCode == REQUEST_PICK_PICTURE) {
if (data != null ) {
selectedImageURI = data.getData();
Log.i(TAG, selectedImageURI.toString());
//realPath =
"/storage/emulated/legacy/20150308_184443.jpg";
realPath = getPath(selectedImageURI);
}
}
// upload the files with android-upload-service
UploadFileToServer(realPath, getActivity());
}
}
and this is my chooseImage method:
private void chooseImage() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select
Picture"), REQUEST_PICK_PICTURE);
}
the 'getPath' returns empty string and the app crashes...
i tried to direct 'realPath' (String) to real photo on SD and it worked.
i would be happy to know what is my noob mistake this time :)
best,
Idan
On Mon, Mar 9, 2015 at 4:57 PM, idanbar134 [email protected] wrote:
Thanks. I learn the hard way :) and I solved it.
On Mar 9, 2015 4:54 PM, "Alex Gotev" [email protected] wrote:@idanbar134 https://github.com/idanbar134 keep working like you do :)
I suggest you to learn how to read Java Stack Trace, as it's your "best
friend" to find out what's going wrong in some cases. Sorry to bother you
with this ticket you opened: #22
#22 again, but
I need to know if you still have the described problem or how you managed
to solve it :)Reply to this email directly or view it on GitHub
#24 (comment)
.
Idan Ayalon
from android-upload-service.
Related Issues (20)
- Initial notification ignores custom notificationHandlerFactory HOT 7
- Stop Observing from RequestObserver using unregister causing a crash. HOT 3
- Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. HOT 6
- Google Play will soon require that apps target API level 33 or higher. This will be required for new apps and updates starting on August 31, 2023. HOT 4
- Single notification about all ongoing uploads HOT 3
- Please add support for Android 34 HOT 4
- Java Code Samples? HOT 1
- How to get uploaded file infomation that returned by service api
- Question: Is it possible to send a HTTP request once an upload task finishes? HOT 5
- Question on crash message when closing the app: Unable to create service net.gotev.uploadservice.UploadService HOT 16
- Missing default constructor for SchemeHandler classes HOT 3
- Incompatible version of Kotlin error after upgrading to 4.9.2 HOT 3
- register gotev receiver HOT 2
- Result of uploading file HOT 1
- Bitrise CI Build Failing with New Version HOT 1
- Re-implementation using WorkManager HOT 2
- Android Upload Service for KMM (Koltin Multiplateform) HOT 2
- Add contentType to addParameter HOT 3
- SDK 34 Play Store Rejected without video of FOREGROUND_SERVICE_DATA_SYNC functionality HOT 4
- duplicate uploadID HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-upload-service.