意图活动

时间:2016-09-08 07:31:22

标签: listview android-intent

我正在尝试从lisview调用一个活动但是当我调用intent我的应用程序崩溃时我正在尝试使用bla活动但是也崩溃了,我的listview在tabwidget里面可以帮助我。

这是我的代码。

SELECT name FROM user a,friendtable b WHERE a.id=b.id AND  b.recvid>=3

SELECT name FROM  user a,friendtable b WHERE a.id=b.id and  b.recvid>3 AND b.recid<2

SELECT name FROM  user a,friendtable b WHERE a.id=b.id AND  b.recid<2
                        lstResumen.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                            @Override
                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                                try {

                                    //Obtiene el cursor asignado a este listview
                                    Cursor Cursor_Resumen = (Cursor) parent.getItemAtPosition(position);
                                    //Llena las variables con los valores correspondientes
                                    Global.Parametro1 = Cursor_Resumen.getString(Cursor_Resumen.getColumnIndexOrThrow("_id"));
                                    Global.Parametro2 = Cursor_Resumen.getString(Cursor_Resumen.getColumnIndexOrThrow("id_precio"));
                                    //I02.9622.157
                                    Cursor_Resumen.close();

                                    int Cantidad_Fichas = 0;
                                    String SWhere = "";
                                    SWhere = "id_producto=?";

                                    //Verifica si ya se ingreso ficha para este producto si no se ha ingresado llama el activity de fichas
                                    margs = new String[]{Global.Parametro1};
                                    Cantidad_Fichas = manager.Consulta_Campo_Int("ifnull(count(*),0) AS cuantos", "cuantos", SWhere, "fichas", margs);

                                    if (Cantidad_Fichas == 0) {

                                        try {

                                            Intent intent = new Intent(view.getContext(), Serie.class);
                                            view.getContext().startActivity(intent);


                                        } catch (Exception e) {
                                            message = e.getMessage();
                                            Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
                                        }

                                    } else {
                                        Toast.makeText(getBaseContext(), "Esta ficha ya fue ingresada", Toast.LENGTH_LONG).show();
                                        return;
                                    }

                                } catch (Exception e) {
                                    message = e.getMessage();
                                    Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
                                }

                            }

                        });

0 个答案:

没有答案