0

I don't know where is the issue with this code? it gives a blank imageView in Nav header....

This is the code:

  final View header = navigationView.getHeaderView(0);
        TextView text = (TextView) header.findViewById(R.id.TxtUsernametitle);
        TextView Tmail = (TextView)header.findViewById(R.id.textmail);
       imageView1 = (ImageView)header.findViewById(R.id.imageView1);

        String Tusern = currentUser.getUsername();
        String Tmails = currentUser.getEmail();
        text.setText(Tusern);
        Tmail.setText(Tmails);
        String usId= currentUser.getObjectId().toString();
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Profile");
        query.whereEqualTo("userID", usId);
        query.getFirstInBackground(new GetCallback<ParseObject>() {
            public void done(ParseObject object, ParseException e) {
                if (object == null) {

                    ParseFile fileObject = (ParseFile) object.getParseFile("picture");
                    fileObject
                            .getDataInBackground(new GetDataCallback() {

                                public void done(byte[] data,
                                                 ParseException e) {
                                    if (e == null) {
                                        // Decode the Byte[] into
                                        // Bitmap
                                        Bitmap bmp = BitmapFactory
                                                .decodeByteArray(
                                                        data, 0,
                                                        data.length);

                                        // initialize
                                       // ImageView imageView1 = (ImageView)header.findViewById(R.id.imageView1);

                                        // Set the Bitmap into the
                                        // ImageView
                                        imageView1.setImageBitmap(bmp);

                                    } else {

                                    }
                                }
                            });
                } else {
                }
            }
        });

It doesn't any log or errors in my screen...

Your help will be appreciated!!! Regards, Marwan

user3480753
  • 1
  • 1
  • 4

2 Answers2

0

https://github.com/facebook/fresco

https://github.com/bumptech/glide

http://square.github.io/picasso/

https://github.com/koush/ion

https://github.com/nostra13/Android-Universal-Image-Loader

Just download the image url from parse and pass the url to any one of the library and give imageView reference to that library.

My suggestion go with 'Parse' / 'Glide' for image . 'ion' for max file types ( video / zip / txt ) you can download.

Anvesh523
  • 368
  • 6
  • 18
  • Thanks, I am new on this Android. I want to know what is it theses links? – user3480753 Dec 28 '15 at 08:21
  • Simple, These all are android libraries to reduce developer work, just open http://square.github.io/picasso/ link. follow the steps. they will provide one sample app to understand how to work with that library. http://javatechig.com/android/how-to-use-picasso-library-in-android this link will help U. – Anvesh523 Dec 28 '15 at 09:28
  • LOL! Do you have others librairies to reduce developer work? as I am new in Android. – user3480753 Dec 28 '15 at 10:37
  • That's based on what functionality U want.... Try this link .. http://android-arsenal.com/ This will help U. – Anvesh523 Dec 28 '15 at 10:53
  • If U satisfied with my answer, accept and vote up ;) – Anvesh523 Dec 28 '15 at 10:56
  • U can see one tick mark left side to my answer and up & down arrows. Just Click on tick mark and up arrow. :) – Anvesh523 Dec 28 '15 at 13:22
  • Can you help me on this post? http://stackoverflow.com/questions/34494475/how-retrieve-image-from-gallery – user3480753 Dec 28 '15 at 13:35
0

put this code at a object == null in side

ParseFile image = (ParseFile) object.get("picture");
    // now u want to use picaso library for image loaded in image view like
    Picasso.with(getApplicationContext()).load(image.getUrl()).placeholder(R.drawable.ic_launcher).fit()
            .into(imageView);

and remove old code.

Hardik Parmar
  • 712
  • 2
  • 13
  • 28