Unable to fetch the stored data from
<p>Below is my code from my activity. I call <code>setKey()</code> to set the key, but when I use <code>getKey()</code> it returns <code>""</code>;</p>

<pre><code>public class SharedData {
    // This is a singleton class that provides a global data
    private SharedData instance = null;

    private SharedData() {
    }

    // Data to be shared
    private String key = "";

    public static SharedData getInstance() {
        instance = new SharedData();
        return instance;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String skey) {
        key = skey;
    }
}
</code></pre>
