How to access data in the previous activity?
<p>Using <code>StartActivity</code> i reached SecondActivity from FirstActivity..Now i want to access object declared in the previous activity.</p>

<p>Is there any obvious mechanisms that i am missing.I cant use Parceable on the object(DropboxAPI) i want to pass since i do not have its source(i can't make it parceable).</p>

<p>Can i pass <code>FirstActivity.this</code> since i can make it Parceable using an intent?or like</p>

<pre><code>    Intent intent=new Intent(FirstActivity.this,SecondActivity.class);
    intent.putExtra("MyClass",FirstActivity.this);
    startActivity (intent);

import com.dropbox.client2.DropboxAPI;
import com.dropbox.client2.android.AndroidAuthSession;

import android.app.Application;
import android.hardware.Camera.Parameters;
import android.os.Parcel;
import android.os.Parcelable;
public class temp extends Application {

    DropboxAPI&lt;AndroidAuthSession&gt; mApi;
    public void onCreate() {  
        super.onCreate();  
    }

    temp(DropboxAPI&lt;AndroidAuthSession&gt; Api)
    {
        mApi=Api;
    }
    public DropboxAPI&lt;AndroidAuthSession&gt; getName() {    
        return mApi;  
} 
    public void setName(DropboxAPI&lt;AndroidAuthSession&gt; dropboxclient) {  
        this.mApi = dropboxclient;  
}
}
</code></pre>

<p>Code in first class:</p>

<pre><code>t = (temp)getApplication();
                t.setName(mApi);
                //basket.putParcelable("key", MCActivity.this);
                Intent intent=new Intent(MCActivity.this,DownActivity.class);
                //intent.putExtra("MyClass",t);
                startActivity (intent);
</code></pre>

<p>Code in Second class:</p>

<pre><code>public void onCreate(Bundle bun) {

    // TODO Auto-generated method stub
    super.onCreate(bun);
    setContentView(R.layout.download);
    mImage = (ImageView)findViewById(R.id.image_view);
    //Bundle gotit=getIntent().getExtras();
    t = (temp)getApplication();
    int i=2;
    i=5;
    dApi=t.getName();
}
</code></pre>

<p>Logcat:</p>

<pre><code>06-28 02:24:31.979: I/System.out(729): debugger has settled (1308)
06-28 02:25:08.387: D/AndroidRuntime(729): Shutting down VM
06-28 02:25:08.387: W/dalvikvm(729): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-28 02:25:08.705: E/AndroidRuntime(729): FATAL EXCEPTION: main
06-28 02:25:08.705: E/AndroidRuntime(729): java.lang.ClassCastException: android.app.Application
06-28 02:25:08.705: E/AndroidRuntime(729):  at cloud.mobile.MCActivity$3.onClick(MCActivity.java:164)
06-28 02:25:08.705: E/AndroidRuntime(729):  at android.view.View.performClick(View.java:2408)
06-28 02:25:08.705: E/AndroidRuntime(729):  at android.view.View$PerformClick.run(View.java:8816)
06-28 02:25:08.705: E/AndroidRuntime(729):  at android.os.Handler.handleCallback(Handler.java:587)
06-28 02:25:08.705: E/AndroidRuntime(729):  at android.os.Handler.dispatchMessage(Handler.java:92)
06-28 02:25:08.705: E/AndroidRuntime(729):  at android.os.Looper.loop(Looper.java:123)
06-28 02:25:08.705: E/AndroidRuntime(729):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-28 02:25:08.705: E/AndroidRuntime(729):  at java.lang.reflect.Method.invokeNative(Native Method)
06-28 02:25:08.705: E/AndroidRuntime(729):  at java.lang.reflect.Method.invoke(Method.java:521)
06-28 02:25:08.705: E/AndroidRuntime(729):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-28 02:25:08.705: E/AndroidRuntime(729):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-28 02:25:08.705: E/AndroidRuntime(729):  at dalvik.system.NativeStart.main(Native Method)
</code></pre>
