如何将数据从活动发送到存储库?

问题描述

我想将一个活动中的变量的一些值发送到存储库。不幸的是,我不能使用getIntent()方法。那我该怎么做呢?

    Bundle bundle = new Bundle();
                    bundle.putDouble("lat",location.getLatitude());
                    bundle.putDouble("lon",location.getLongitude());

                    Intent intent = new Intent(getApplicationContext(),forecastrepository.class);
                    intent.putExtras(bundle);


startActivity(new Intent(getApplicationContext(),MainActivity.class))

;

存储库

private void getCoords(){
    //Todo
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)