• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Imageview not showing image on a specific tablet

fedee13

Lurker
I'm stuck in the following problem and I don't know what to do:

Main Activity:

Code:
package com.example.rwallpapers;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.ImageView;

public class MainActivity extends Activity {
ImageView mImageView;
String path1 = "/mnt/internal_sd/Pictures/RP/1.png"; 
String path2 = "/mnt/internal_sd/Pictures/RP/2.png";
String path3 = "/mnt/internal_sd/Pictures/RP/3.png";
String path4 = "/mnt/internal_sd/Pictures/RP/4.png";
String path5 = "/mnt/internal_sd/Pictures/RP/5.png";
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

    public void launchImageView(View v) {
        switch (v.getId()) {
            case R.id.imageButton1:
                Intent i = new Intent(this, ImageViewActivity.class);
                i = new Intent(this, ImageViewActivity.class);
                //i.setData(Uri.parse(path1));
                i.setData(Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Pictures/RP/1.png"));
                startActivity(i);
            break;
            case R.id.imageButton2:
                i = new Intent(this, ImageViewActivity.class);
                //i.setData(Uri.parse(path2));
                i.setData(Uri.parse(Environment.getExternalStorageDirectory()+"/Pictures/RP/2.png"));
                startActivity(i);
                break;
            case R.id.imageButton3:
                i = new Intent(this, ImageViewActivity.class);
                i.setData(Uri.parse(path3));
                //i.setData(Uri.parse(Environment.getExternalStorageDirectory()+"/Pictures/RP/3.png"));

                startActivity(i);
                break;
            case R.id.imageButton4:
                i = new Intent(this, ImageViewActivity.class);
                i.setData(Uri.parse(path4));
                //i.setData(Uri.parse(Environment.getExternalStorageDirectory()+"/Pictures/RP/4.png"));
                startActivity(i);
                break;
            case R.id.imageButton5:
                i = new Intent(this, ImageViewActivity.class);
                i.setData(Uri.parse(path5));
                //i.setData(Uri.parse(Environment.getExternalStorageDirectory()+"/Pictures/RP/5.png"));
                startActivity(i);
                break;

        }
    }
}
ImageViewActivity:

Code:
package com.example.rwallpapers;

import android.os.Bundle;
import android.widget.ImageView;

public class ImageViewActivity extends MainActivity {
    ImageView im;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_imageview);

    im = (ImageView) findViewById(R.id.image_content);

    im.setImageURI(getIntent().getData());

    //Toast.makeText(getApplicationContext(),"hello", Toast.LENGTH_LONG).show();        
}
}
In the manifest I wrote the permission:

Code:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
I tested this on my phone and on a tablet and it works perfectly. Using this:

Code:
i.setData(Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Pictures/RP/1.png"));
Or this:

Code:
i.setData(Uri.parse(Environment.getExternalStorageDirectory()+"/Pictures/RP/2.png"));
Or even the hardcoded path.

But on the tablet that we are releasing it does not show the image on the imageview.

This path is the one that appears if I see the properties of the file on a file explorer:
Code:
"/mnt/internal_sd/Pictures/RP/1.png"
Even if I hardcoded it, it doesn't work.

And this is what the file explorer says at the top:
Code:
NAND FLASH/Pictures/RP
The tablet is running Android 5.1.1.

What am I missing?
 
Back
Top Bottom