title: how do I get value from BroadcastReceiver activity to main activity
body: <p>I want get the install referrer value in my <code>MainActivity</code>. For that i am using two class</p>
  
  <p>1) <code>MainActivity</code></p>
  
  <p>2) <code>ReferrerReceiver</code></p>
  
  <p>I got received install referrer value successfully in <code>ReferrerReceiver</code> class, i tested this using Toast control.</p>
  
  <p>But i can not able to pass this value to <code>MainActivity</code> from <code>ReferrerReceiver</code>.</p>
  
  <p>Bellow is i tried code. please any one help me.</p>
  
  <p>Thanks for advance.</p>
  
  <hr>
  
  <p><strong>1) MainActivity.java</strong></p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          TextView tv1 = (TextView) findViewById(R.id.tv1);
          Intent in1= getIntent();
          String ldString = in1.getStringExtra("number");
          tv1.setText(ldString);
  
      }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>2) ReferrerReceiver.java</strong></p>
  
  <pre><code>public class ReferrerReceiver extends BroadcastReceiver {           
      @Override
      public void onReceive(Context context, Intent intent) {
  
          if (!intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) {
              return;
          }
  
            Bundle bundle = intent.getExtras();        
            String phoneNumber = bundle.getString("referrer");
            Intent i = new Intent(context, MainActivity.class);
            i.putExtra("number", phoneNumber);
            context.startActivity(i);
    }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.myreferrer.in"
        android:versionCode="7"
      android:versionName="1.0.6" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme"                
           &gt;
  
          &lt;receiver android:name="com.myreferrer.in.ReferrerReceiver"
              android:enabled="true"&gt;               
                  &lt;action android:name="com.android.vending.INSTALL_REFERRER" /&gt;
                  &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name" 
              android:launchMode="singleTask"
              &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>