我在使用Intent导航屏幕时遇到问题.我想发送一个变量并在其他类中使用它.
我正在使用一个方法,该方法接受变量,但我不知道如何将其与意图发送到新屏幕,这将使用它来做一些事情.
主类调用metod:
private void pantallaDetalles(final int identificador)
{
startActivityForResult(new Intent(this,MostrarDetalles.class),REQST_CODE);
}
Run Code Online (Sandbox Code Playgroud)
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);
}
Run Code Online (Sandbox Code Playgroud)
你看到吗?我在说这个.我不知道如何通过Intent将"identify"变量从主类发送到第二类.
你能帮帮我吗?非常感谢你的建议.
JMasia.