On Tue, Jan 31, 2012 at 6:37 AM, geo <[email protected]> wrote:
> Hello,i am getting error:
>
> Caused by: java.lang.NullPointerException
> E/AndroidRuntime(329): at ...LineGraph.getIntent(LineGraph.java:109)
> E/AndroidRuntime(329): at ....LineGraph.onCreate(LineGraph.java:80)
> E/AndroidRuntime(329): at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1047)
> E/AndroidRuntime(329): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2627)
>
> I have in one activity :
>
> double []myfinal=new double [100];
>
> Then,inside a function:
>
> public void compute(){
> ...
> //fill the points between
> for (int i=0;i<=ttime;i++){
> myfinal[i]=init*Math.exp(-l*i);
>
> }
> Intent i=new Intent(this,calcs.class);
> ...
> i.putExtra("finals",myfinal);
> startActivity(i);
> }
>
> And in the other activity(LineGraph):
> ...
> private double [] myfinal=new double [100];
>
> public double [] getFinal(){ return this.myfinal;}
> public void setFinal(double [] myfinal){ this.myfinal=myfinal;}
>
> public void onCreate(Bundle savedInstanceState){
> ...
> double [] myfinal=extras.getDoubleArray("myfinal");
> setFinal(myfinal);
>
> public Intent getIntent(Context context){
> ...
> double []myfinal=getFinal();
>
>
> I am not sure if this is right "double []
> myfinal=extras.getDoubleArray("myfinal");"
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
It seems to me like the tag you are using to put your array into
extras is different from the tag you are using when retrieving it.
How about:
double [] myfinal=extras.getDoubleArray("finals");
-jm
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en