HI,
I have an android class that looks like this:
----------------------------------------
package org.renpy.android;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.util.ArrayList;
import org.renpy.android.ResourceManager;
public class GetText {
Context context;
public ResourceManager mManager;
public void GetText() {
}
public String getText(Activity c, String in) {
mManager = new ResourceManager(c);
int mId = mManager.getIdentifier(in,"raw");
context = c.getApplicationContext();
String out = "";
if (true) {
InputStream inputStream = context.getResources().openRawResource(mId);
InputStreamReader inputreader = new InputStreamReader(inputStream);
BufferedReader buffreader = new BufferedReader(inputreader);
String line;
StringBuilder text = new StringBuilder();
try {
while ((line = buffreader.readLine()) != null) {
text.append(line);
text.append('\n');
}
} catch (IOException e) {
return null;
}
//return text.toString();
out = text.toString();
}
return out;
}
}
-----------------------------------------
I also have some python code that looks like this:
-----------------------------------------
i=0
GetText = jnius.autoclass("org.renpy.android.GetText")
PythonActivity = jnius.autoclass('org.renpy.android.PythonActivity')
loader = GetText()
shapew1 = str(name+'_shape_w'+str(i+1))
activity = PythonActivity.mActivity
wshape = loader.getText(activity, shapew1)
-----------------------------------------
BUT, my android app always crashes on the line that starts 'wshape = loader...'
what am i doing wrong?? loader.getText() is supposed to return a string to wshape, from a resource that I know exists. Is this sort of thing not possible with pyjnius?
thanks,
Dave Liebman