Yes, I also ran into this problem.
Many developers also encounter problems transferring data from the dialogue to another activity via Intent or Bundle. It returns null when it is received from another action.
And the only solution is SharedPreferences.
But you have to put it in the dismiss button (for example: ok / cancel, etc.)
And it's easy to get data from another activity through the same key. Do not use a service followed by a broadcast intent.
The code in the dialog operation is as follows:
AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(R.drawable.mailicon); builder.setTitle(name); builder.setView(view); builder.setPositiveButton("Send Request",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String mailID = id.getText().toString();
And from another, select the following data:
SharedPreferences bb = getSharedPreferences("my_prefs", 0); String m = bb.getString("NUM", ""); Toast.makeText(this, m, Toast.LENGTH_SHORT).show();
Add some checks for a good standard.
thanks
Ranjit
source share