【发布时间】:2011-03-17 18:28:46
【问题描述】:
我在使用 Intent 浏览屏幕时遇到问题。我想发送一个变量并在其他类中使用它。
我正在使用一种方法,该方法采用变量,但我不知道如何将其与意图一起发送到新屏幕,新屏幕将使用它来做一些事情。
主类调用方法:
private void pantallaDetalles(final int identificador)
{
startActivityForResult(new Intent(this,MostrarDetalles.class),REQST_CODE);
}
MostrarDetalles.class 是 *.java,它将接受变量。我是这样开始的:
public class MostrarDetalles extends Activity {
SQLiteDatabase db;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.detalles);
//more code...
Cursor c = db.rawQuery("SELECT * FROM table WHERE _id="+ identificador, null);
}
你看到了吗?我正在谈论这个。我不知道如何通过Intent将“identificador”变量从主类发送到第二类。
你能帮我解决这个问题吗?非常感谢您的建议。
JMasia。
【问题讨论】:
标签: android class variables android-intent