我的项目有两个问题.1)传递并从一个活动到另一个活动获取字符串值2)OnPost中的对话列表视图执行

时间:2013-01-15 07:25:32

标签: android database listview android-intent

我正在尝试在Android上执行一个简单的数据库项目。我的项目有两个问题:

  1. 我想将第一个活动的字符串值传递给第二个活动 并在两个活动中将字符串值传递给第三个活动。一世 无法获取第三个活动中的字符串值。检查一下,我有一个 打印sts,但它没有报告。没有抛出任何错误。
  2. 我想在第二个活动的对话框内的列表视图中显示数据     当OnPostExecute被触发时。我收到了一个错误,但我只是做了一个错误     arrayadapter。它显示成功。
  3. 我做错了什么?

    查看我的代码here

2 个答案:

答案 0 :(得分:1)

将值从Activity传递给Activity 在启动Activity之前使用Intent.putExtra 喜欢这个

`Intent intent = new Intent(getApplicationContext(), NewActivty.class);
intent.putExtra("Key", "Value");
startActivity(intent);` 

并在下一个Activty Recive上使用getExtra

 Bundle getValue= getIntent().getExtras();

 if(GetValue!=null);

 String GetIntentValue= GetValue.getExtras("Key");

答案 1 :(得分:0)

在第一堂课

Intent intent = new Intent(this, nextclass.class);

intent = putExtra("YOUR_KEY" , yourstringhere);

startActivity(intent);

在接收班上

Bundle data = getIntent().getExtras();

if(data!=null);

String receiver = data.getExtras("YOUR_KEY");

古德勒克。