Java – When passed to a child activity, the Bundle becomes null

When passed to a child activity, the Bundle becomes null… here is a solution to the problem.

When passed to a child activity, the Bundle becomes null

I’m using the standard Android Intent/Bundle method to pass data to child activities.

The problem is that while intents look good before the activity starts, they appear null in child activities. I can’t find anyone else who has encountered this issue, so I thought I’d ask for instructions on where to look/how to debug.

(Target Android 2.1).

Parent Activity Fragment


    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);

Intent i = new Intent(ctx, ArticleView.class);

i.putExtra("url", articles.get(position).url.toString());
         The following line correctly logs the URL
        Log.d(TAG,"Starting article viewer with url " + i.getStringExtra("url"));


child Activity fragment :

protected void onCreate(Bundle icicle) {


if (icicle != null) {
         Never called!
    } else {
         Always called
        Log.d(TAG,"Icicle is null - no URL passed in");


Ignoring the fact that icicle is null and trying to retrieve state information from it (using getString) results in a hang and:

03-14 22:23:03.529: WARN/ActivityManager(52): Activity HistoryRecord{44ddd238 com.t.s/. ArticlesList} being finished, but not in LRU list

Any tips are greatly appreciated.


What is passed to the child activity (or any activity) constructor is not an intent.

Intent can be obtained by


Intent intent = getIntent();

The bundle icicle you are referring to is the bundle that an activity uses when it resumes from a suspended state. For example. If you need to save any state of an activity before restarting, this is where the data is stored.

Related Problems and Solutions