Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This can be clearly observed step by step by running the application in Debugging mode by keeping some debugging points and using F6 for step by step execution.</p> <hr> <p>Sending or Receiving Objects or Strings</p> <p><strong>Sending string data</strong></p> <p>As we already know that we can transfer from one to other Activity by using Intents.</p> <pre><code>Intent i = new Intent(MainActivity.this,GoActivity.class); String data = “bla bla”;// Data String to send i.putExtra("DATA",data ); </code></pre> <p><strong>Receiving the Data</strong></p> <p>We can receive the above the string data as shown below.</p> <pre><code>Intent i = getIntent(); String data = i.getStringExtra("DATA");// you well get the String data i.e., BLA BLA </code></pre> <p>The Red Colored DATA should be same while sending and receiving the data.</p> <p><strong>Sending Object</strong></p> <p>Here is the code to send the Object from one to other class. One Important thing to send the Object is the class should implement the Serializable class.</p> <p>The below Red Colored text should be same.</p> <p>//MainActivity.java</p> <pre><code>Intent i = new Intent(MainActivity.this,startActivity.class); ObjectClassName object = new ObjectClassName(); i.putExtra("THIS", Object); </code></pre> <p><strong>Receiving Object</strong></p> <p>// startActivity.java</p> <pre><code>Intent i = getIntent(); ObjectClassName obj = (ObjectClassName) getIntent().getSerializableExtra("THIS");// TypeCasting needed </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload