单击模拟器中的后退按钮时,活动不显示任何内容 [英] when clicking back button in emulator then activity shows nothing

查看:90
本文介绍了单击模拟器中的后退按钮时,活动不显示任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨frnds,



我有两个活动,每个活动都有listview数据。当点击第一个活动的列表视图中的任何项目发送到第二个活动,然后点击模拟器后退按钮然后空屏幕显示而不是回到第一个活动。请帮助我解决这个问题....

Hi frnds,

I have two activity and each activity has listview data.when clicking any item from the listview of first activity sends to second activity, then clicking emulator back button then empty screen display instead of come back to the first activity. pls help me to solve this....

推荐答案

当你从第一个活动转到第二个活动时,你会销毁第一个活动。

单击列表项以转到第二个活动时,请尝试以下代码。



When you move from first activity to second activity , you destroy the first activity.
You try the following code when click on list item to go to the second activity.

listView.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView					long arg3) {
				// TODO Auto-generated method stub
			Intent i = new Intent(this,SecondActivtiyName.class);
			startActivity(i);
			}
		});


这篇关于单击模拟器中的后退按钮时,活动不显示任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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