How to save a string on android without "contains a path separator" ERROR

edited February 2018 in Android Mode

Alright so my code is basically:

int gun; gun = int(loadStrings("gun.txt"));

I get an error about a path separator. The code used to be "data/gun.txt" instead of "gun.txt" because of the error. Didn't fix it. I have tried another thread but it didn't work and this problem for some reason isn't asked often according to me not finding anything so can anyone help?

Answers

  • I have tried another thread but it didn't work

    Can you post that other thread? It is good for documentation

    Yes, I agree, this issue is common. Check this: https://forum.processing.org/two/discussion/25419/how-to-load-and-save-table-on-android-without-error-file-contains-a-path-separator

    Kf

  • edited February 2018

    @RockyHawk===

    are you LOADING (from your data folder) or are you SAVING with some path which includes a "/"???? - If the second one, this question has been solved a lot of time; look to the forums.

  • @akenaton

    I am saving and loading with the same directory used. So i use "data/gun.txt" but u have tried "gun.txt" on its own aswell.

  • @kfrajer I tried the thread you posted, nothing there worked. Either the same error or some other error that is longer than the initial error.

  • Show an MCVE demonstrating your problem. Also specify Android Mode version, Processing version and OS. What permissions have you enabled for your android sketch?

    On a side note,

    int gun;
    gun = int(loadStrings("gun.txt"));

    Please check the reference for proper usage of these functions. What you are trying to do here is not going to work. Hint: What type of structure does loadStrings() returns.

    Kf

  • edited February 2018 Answer ✓

    @kfrajer Hey I did some troubleshooting and somehow it started working? :) I used the same code (just "gun.txt") and it launched. So I don't know what was wrong with the code as it is around 800 lines long but anyways "gun.txt" and "guns/pistol.png" for images seem to work? Thanks for the help though :)

    EDIT:

    I did add the following code to the code because i saw someone else with it so maybe that fixed it idk because I'm new in android mode.

    import android.app.Activity; import android.content.Context; import android.widget.FrameLayout; import android.os.Environment; import android.graphics.Color; import android.widget.Toast; import android.os.Looper; import android.view.WindowManager; import android.os.Bundle; import android.view.ViewParent; import android.view.ViewGroup; import android.view.View; import android.widget.RelativeLayout; import android.view.LayoutInflater; import android.R.string;

Sign In or Register to comment.