application class returning null value
<p>This is my non-activity class:</p>

<pre><code>import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

public class PostManager {

    private Bundle bundle;
    private Context context;
    private Session session;
    private String victimId=null;

    public PostManager() {
        SavedFriend savedFriend = new SavedFriend();
        bundle = savedFriend.getBundle();
        context = savedFriend.getContext();
        session = savedFriend.getSession();
        victimId = savedFriend.getfriendsId();

        Log.e("postManager", victimId);
        Log.e("postManager", bundle.getString("message"));
    }
}
</code></pre>

<p>This is my application class:</p>

<pre><code>import java.util.List;

import android.app.Application;
import android.content.Context;
import android.os.Bundle;

import com.facebook.Session;
import com.facebook.model.GraphUser;

public class SavedFriend extends Application {
    private List&lt;GraphUser&gt; selectedUsers;
    private String friendsId;
    private Session session;
    private Bundle bundle;
    private Context context;

    public List&lt;GraphUser&gt; getSelectedUsers() {
        return selectedUsers;
    }

    public void setSelectedUsers(List&lt;GraphUser&gt; selectedUsers) {
        this.selectedUsers = selectedUsers;
    }

    public String getfriendsId() {
        return friendsId;
    }

    public void setfriendsId(String id) {
        this.friendsId = id;
    }

    public Session getSession(){
        return session;
    }

    public void setSession(Session session){
        this.session = session;
    }

    public void setContext(Context context){
        this.context = context;
    }

    public Context getContext(){
        return context;
    }

    public void setBundle(Bundle bundle){
        this.bundle = bundle;
    }

    public Bundle getBundle(){
        return bundle;
    }
}
</code></pre>

<p>I have used the data of the application class in a fragment class <code>(friendsId)</code> which is not null.</p>

<p>When I call the application class's data from <code>PostManager</code> it returning the value null.</p>

<p>I have tried to see the value of <code>friendsId</code> and <code>message</code> by <code>Log.e</code>. but it gives me nullPointer exception.</p>

<p>Does that means all of the values I call in my <code>PostManager constructor</code> from application class are null? If yes, what should I do?</p>

<p>I need the session, applicationcontext, message, friendsId value in my <code>PostManager</code> class. I can pass these values to <code>PostManager</code>, but this class is called by <code>onReceive()</code> of <code>alarm class</code> which class extends <code>BroadcastReceiver</code>, and this alarm is set from another class which extend <code>Fragment</code>. All the values I need are created by this class except <code>friendsId</code>, and I don't know how to pass these value from first class->alarm class->postmanager class.</p>

<p>In manifest for alarm class:</p>

<pre><code>&lt;application android:name=".SavedFriend"
  .......&gt;
  ....
  &lt;receiver android:name="package name.Alarm"/&gt;
  ....
&lt;/application&gt;
</code></pre>
