Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将一些值传递给onReceive(). BroadcastReceiver我正在实现一个警报,当警报触发时,我需要根据我之前获得的一些文本值显示一些文本?关于如何做到这一点的任何建议?
onReceive()
BroadcastReceiver
你进来intent了public void onReceive(final Context context, Intent intent)。通过意图,您可以获得您设置的值。
intent
public void onReceive(final Context context, Intent intent)
这将把价值intentObject.putExtra("key", "text");
intentObject.putExtra("key", "text");
要得到intent.getExtras.getString("key");
intent.getExtras.getString("key");