Tuesday, July 9, 2013

[android help] Android resource not found exception. Specify a resource by string


Android resource not found exception. Specify a resource by string




package com.example.tictactoe3d;

import min3d.core.Object3dContainer;
import min3d.core.RendererActivity;
import min3d.parser.IParser;
import min3d.parser.Parser;

import min3d.vos.Light;

public class MainActivity extends RendererActivity {

private Object3dContainer objModel;

@Override
public void initScene() {

scene.lights().add(new Light());

IParser parser = Parser.createParser(Parser.Type.OBJ,getResources(), "res/raw/camaro_obj" , true);
parser.parse();

objModel = parser.getParsedObject();
//objModel.scale().x = objModel.scale().y = objModel.scale().z = .7f;
scene.addChild(objModel);
}

@Override
public void updateScene() {
//objModel.rotation().x++;
//objModel.rotation().z++;
scene.camera().position.setAll(0,0,5);
}
}


I am getting a resource not found exception coming out into the log of Eclipse ADT. The min3d library I am using requires to access the resource with a string. I am able to access the resource using R.raw.camaro_obj with the auto complete however the min3d library wants to access that same resource with a string. I have tried:



"com.example.tictactoe3d:raw/camaro_obj"

"res/raw/camaro_obj"

"raw/camaro_obj"


Is there some way to access the resource "res/raw/camaro_obj" by string somehow?


Thanks...


The call in min3d sample project looks like this:



IParser parser = Parser.createParser(Parser.Type.OBJ,getResources(), "min3d.sampleProject1:raw/test2_obj" , true);


The code that is actually called by that line is doing this:



public AParser(Resources resources, String resourceID, Boolean generateMipMap)
{
this();
this.resources = resources;
this.resourceID = resourceID;
if (resourceID.indexOf(":") > -1)
this.packageID = resourceID.split(":")[0];
this.generateMipMap = generateMipMap;
}


Read more

stackoverflow.comm



No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...