Device not displaying image

You must Login before you can answer or comment on any questions.

Hi, I tried to implement a simple display, with images the app showing the image in emulator but if I deploy it in device no images getting displayed. Please tell me the solution

Ti.UI.setBackgroundImage('android/common_bg.png');
var foodLogo = Ti.UI.createImageView({
        top:'5%',
        left:'5%',
        zIndex:1,
        width:'444px',
        height:'191px',
        image:'../android/foodango_logo.png'
    });
 
// This is some solution I saw it internet
var back_fn=Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'../android/LandingPage/login_btn.png');
    var LoginImage = Ti.UI.createImageView({
        top:'50%',
        left:'5%',
        zIndex:1,
        image:back_fn
    });
 
var viewLandingPage= Ti.UI.createWindow({
        width:'100%',
        height:'100%'
    });
 
    viewLandingPage.add(foodLogo);
    viewLandingPage.add(LoginImage);
I also tried adding
<property name="ti.android.fastdev" type="bool">true</property>
Also tried adding it to view and setting background .

But no use can someone please let me know the solution for this. I never faced some problem with Iphone for android I am facing this kind of wierd problem

Thanks in Advance, SK

1 Answer

Accepted Answer

Hi

Can you tweak your code for me to the following and report back if this has solved it.

Ti.UI.setBackgroundImage('android/common_bg.png');
var foodLogo = Ti.UI.createImageView({
        top:'5%',
        left:'5%',
        zIndex:1,
        width:'444px',
        height:'191px',
        image:'/foodango_logo.png'
    });
 
// This is some solution I saw it internet
var back_fn=Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'/LandingPage/login_btn.png');
    var LoginImage = Ti.UI.createImageView({
        top:'50%',
        left:'5%',
        zIndex:1,
        image:back_fn
    });
 
var viewLandingPage= Ti.UI.createWindow({
        width:'100%',
        height:'100%'
    });
 
    viewLandingPage.add(foodLogo);
    viewLandingPage.add(LoginImage);
Also make sure that the filenames and folders you have are EXACTLY the same case, your second image has upper and lower case letters, your physical files should match this.

Your Answer

Think you can help? Login to answer this question!