This is the bundle is not transmitting data, get to
This occurs because there is no context in the non-activity class, and the context is required to transfer data in the activity.
I have collected two solutions.
1.
Declare an activity (or context) in the activity that invokes the adapter.
Public static Activity mactivity;
And then assign a value to mactivity in the OnCreate function.
mactivity = this;
You can then invoke this static mactivity in adapter to start the activity.
Activity.mActivity.startActivity (intent);
The activity that starts this way is the data that can be obtained.
2.
Get a context startup activity directly.
GetContext (). StartActivity (intent);
This is also possible to obtain data, I think this method may be problematic, but the level is limited, do not know what the problem.
So that we can happily transfer data in non-activity.
By csdn turn a few stickers, reading volume is my original post several times, add a anti-theft link:zhangjiuding
Android transmits data in a normal class (non-activity, mostly adapter) to a NULL solution: Transfer data in startactivity with intent