活动之间移动 [英] Moving between Activity

查看:86
本文介绍了活动之间移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个活动。第一个是登录活动和第4是用户的数据发送到服务器。现在我想做的是当数据发送成功,我婉用户从活动4.移动到活动2我怎样才能达致这场景。

我要实现这个handleSuccessSaveOrder(),这将带我从4日至2日活动

 私人无效saveOrder(最终订单顺序){
    线程线程=新主题(新的Runnable(){
        @覆盖
        公共无效的run(){
            尝试{
                。的getConnection()saveOrder(订单);
                // handleSuccessSaveOrder();
            }
            赶上(例外EXC){
                Log.d(--- ERROR ---,exc.getMessage());
                handleException(exc.getMessage());
            }
        }
    });
    thread.start();
}


解决方案

在年底你的 handleSuccessSaveOrder(),做如下:

 意向意图=新意图(这一点,Your_activity_2_class_name.class);
intent.putExtra(PARAM_KEY,值); //如果你想传递PARAMS新的使用意向
startActivity(意向);

I have 4 Activity. the first being the login activity and the 4th being the user sends the data to the server. Now what I want to do is when the data is sent successfully,i wan the user to move to activity 2 from activity 4. How can i acheive this scenario.

I need to implement this handleSuccessSaveOrder() which will take me from 4th to 2nd activity

private void saveOrder(final Order order) {
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                getConnection().saveOrder(order);
                //handleSuccessSaveOrder();
            }
            catch (Exception exc) {
                Log.d("--- ERROR ---", exc.getMessage());
                handleException(exc.getMessage());
            }
        }
    });
    thread.start();
}

解决方案

In the end of your handleSuccessSaveOrder(), do as follow:

Intent intent = new Intent(this, Your_activity_2_class_name.class);
intent.putExtra(PARAM_KEY, value); //use if you want to pass params to new intent
startActivity(intent);

这篇关于活动之间移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆