Skip to main content
se añadieron 4 caracteres en el cuerpo
Origen Enlace
Jorgesys
  • 111.1k
  • 14
  • 55
  • 134

El problema es que estas definiendo los mismos nombres de variables dentro del metodométodo onCreate() por lo tanto unicamente tendranúnicamente tendrán valor dentro del metodode este método.

Realiza el cambio para que las variables puedas ser enviadas con su respectivo valor viavía intent :

El problema es que estas definiendo los mismos nombres de variables dentro del metodo onCreate() por lo tanto unicamente tendran valor dentro del metodo.

Realiza el cambio para que las variables puedas ser enviadas con su respectivo valor via intent :

El problema es que estas definiendo los mismos nombres de variables dentro del método onCreate() por lo tanto únicamente tendrán valor dentro de este método.

Realiza el cambio para que las variables puedas ser enviadas con su respectivo valor vía intent :

se añadieron 679 caracteres en el cuerpo
Origen Enlace
Jorgesys
  • 111.1k
  • 14
  • 55
  • 134
public class UsbSettingActivity extends AppCompatPreferenceActivity {

final String setBaudRate = "" ;
public static String mconfigbaudrate = "";
public static String mconfigdatabit = "";
public static String mconfigbitstop = "";
public static String mconfigparity = "";
public static String mconfigfontsize = "";
public static String mconfigconsolamode = "";
public static String mconfigfindelinea = "";
public static String mconfigenableeco = "";
public static String mconfigfilesave = "";
...
...

Realiza el cambio para que las variables puedas ser enviadas con su respectivo valor via intent :

 public void onCreate(final Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_setup_com);

        setHasOptionsMenu( true );

        bindPreferenceSummaryToValue( findPreference( "config_baud_rate" ) );
        bindPreferenceSummaryToValue( findPreference( "config_data_bit" ) );
        bindPreferenceSummaryToValue( findPreference( "config_bit_stop" ) );
        bindPreferenceSummaryToValue( findPreference( "config_parity" ) );
        bindPreferenceSummaryToValue( findPreference( "config_flow_control" ) );
        bindPreferenceSummaryToValue( findPreference( "config_font_size" ) );
        bindPreferenceSummaryToValue( findPreference( "config_consola_mode" ) );
        bindPreferenceSummaryToValue( findPreference( "config_fin_delinea" ) );
        bindPreferenceSummaryToValue( findPreference( "config_filesave" ) );

        ListPreference SPconfigbaudrate2 = (ListPreference) findPreference("config_baud_rate");
        mconfigbaudrate = SPconfigbaudrate2.getValue();

        ListPreference SPconfigdatabit2 = (ListPreference) findPreference("config_data_bit");
        //String mconfigdatabit = SPconfigdatabit2.getValue();                      mconfigdatabit = SPconfigdatabit2.getValue();

        ListPreference SPconfigbitstop2 = (ListPreference) findPreference("config_bit_stop");
        //String mconfigbitstop = SPconfigbitstop2.getValue();
        mconfigbitstop = SPconfigbitstop2.getValue();

        ListPreference SPmconfigparity2 = (ListPreference) findPreference("config_parity");
        //String mconfigparity = SPmconfigparity2.getValue();                    
         mconfigparity = SPmconfigparity2.getValue();

        ListPreference SPconfigfontsize2 = (ListPreference) findPreference("config_font_size");
        //String mconfigfontsize = SPconfigfontsize2.getValue();            
         mconfigfontsize = SPconfigfontsize2.getValue();

        ListPreference SPconfigconsolamode2 = (ListPreference) findPreference("config_consola_mode");
        //String mconfigconsolamode = SPconfigconsolamode2.getValue();        
        mconfigconsolamode = SPconfigconsolamode2.getValue();

        ListPreference SPconfigfindelinea2 = (ListPreference) findPreference("config_fin_delinea");
        //String mconfigfindelinea = SPconfigfindelinea2.getValue();
        mconfigfindelinea = SPconfigfindelinea2.getValue();

        TwoStatePreference SPconfigenableeco2 = (TwoStatePreference) findPreference("config_enable_eco");
        Boolean mconfigenableecoX = SPconfigenableeco2.isChecked();
        //String mconfigenableeco = String.valueOf(mconfigenableecoX);
        mconfigenableeco = String.valueOf(mconfigenableecoX);

        ListPreference SPconfigfilesave2 = (ListPreference) findPreference("config_filesave");
        //String mconfigfilesave = SPconfigfilesave2.getValue();   
        mconfigfilesave = SPconfigfilesave2.getValue();
    }
 public void onCreate(final Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_setup_com);

        setHasOptionsMenu( true );

        bindPreferenceSummaryToValue( findPreference( "config_baud_rate" ) );
        bindPreferenceSummaryToValue( findPreference( "config_data_bit" ) );
        bindPreferenceSummaryToValue( findPreference( "config_bit_stop" ) );
        bindPreferenceSummaryToValue( findPreference( "config_parity" ) );
        bindPreferenceSummaryToValue( findPreference( "config_flow_control" ) );
        bindPreferenceSummaryToValue( findPreference( "config_font_size" ) );
        bindPreferenceSummaryToValue( findPreference( "config_consola_mode" ) );
        bindPreferenceSummaryToValue( findPreference( "config_fin_delinea" ) );
        bindPreferenceSummaryToValue( findPreference( "config_filesave" ) );

        ListPreference SPconfigbaudrate2 = (ListPreference) findPreference("config_baud_rate");
        mconfigbaudrate = SPconfigbaudrate2.getValue();

        ListPreference SPconfigdatabit2 = (ListPreference) findPreference("config_data_bit");
        //String mconfigdatabit = SPconfigdatabit2.getValue();                      mconfigdatabit = SPconfigdatabit2.getValue();

        ListPreference SPconfigbitstop2 = (ListPreference) findPreference("config_bit_stop");
        //String mconfigbitstop = SPconfigbitstop2.getValue();
        mconfigbitstop = SPconfigbitstop2.getValue();

        ListPreference SPmconfigparity2 = (ListPreference) findPreference("config_parity");
        //String mconfigparity = SPmconfigparity2.getValue();                    
         mconfigparity = SPmconfigparity2.getValue();

        ListPreference SPconfigfontsize2 = (ListPreference) findPreference("config_font_size");
        //String mconfigfontsize = SPconfigfontsize2.getValue();            
         mconfigfontsize = SPconfigfontsize2.getValue();

        ListPreference SPconfigconsolamode2 = (ListPreference) findPreference("config_consola_mode");
        //String mconfigconsolamode = SPconfigconsolamode2.getValue();        
        mconfigconsolamode = SPconfigconsolamode2.getValue();

        ListPreference SPconfigfindelinea2 = (ListPreference) findPreference("config_fin_delinea");
        //String mconfigfindelinea = SPconfigfindelinea2.getValue();
        mconfigfindelinea = SPconfigfindelinea2.getValue();

        TwoStatePreference SPconfigenableeco2 = (TwoStatePreference) findPreference("config_enable_eco");
        Boolean mconfigenableecoX = SPconfigenableeco2.isChecked();
        //String mconfigenableeco = String.valueOf(mconfigenableecoX);
        mconfigenableeco = String.valueOf(mconfigenableecoX);

        ListPreference SPconfigfilesave2 = (ListPreference) findPreference("config_filesave");
        //String mconfigfilesave = SPconfigfilesave2.getValue();   
        mconfigfilesave = SPconfigfilesave2.getValue();
    }
public class UsbSettingActivity extends AppCompatPreferenceActivity {

final String setBaudRate = "" ;
public static String mconfigbaudrate = "";
public static String mconfigdatabit = "";
public static String mconfigbitstop = "";
public static String mconfigparity = "";
public static String mconfigfontsize = "";
public static String mconfigconsolamode = "";
public static String mconfigfindelinea = "";
public static String mconfigenableeco = "";
public static String mconfigfilesave = "";
...
...

Realiza el cambio para que las variables puedas ser enviadas con su respectivo valor via intent :

 public void onCreate(final Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_setup_com);

        setHasOptionsMenu( true );

        bindPreferenceSummaryToValue( findPreference( "config_baud_rate" ) );
        bindPreferenceSummaryToValue( findPreference( "config_data_bit" ) );
        bindPreferenceSummaryToValue( findPreference( "config_bit_stop" ) );
        bindPreferenceSummaryToValue( findPreference( "config_parity" ) );
        bindPreferenceSummaryToValue( findPreference( "config_flow_control" ) );
        bindPreferenceSummaryToValue( findPreference( "config_font_size" ) );
        bindPreferenceSummaryToValue( findPreference( "config_consola_mode" ) );
        bindPreferenceSummaryToValue( findPreference( "config_fin_delinea" ) );
        bindPreferenceSummaryToValue( findPreference( "config_filesave" ) );

        ListPreference SPconfigbaudrate2 = (ListPreference) findPreference("config_baud_rate");
        mconfigbaudrate = SPconfigbaudrate2.getValue();

        ListPreference SPconfigdatabit2 = (ListPreference) findPreference("config_data_bit");
        //String mconfigdatabit = SPconfigdatabit2.getValue();                      mconfigdatabit = SPconfigdatabit2.getValue();

        ListPreference SPconfigbitstop2 = (ListPreference) findPreference("config_bit_stop");
        //String mconfigbitstop = SPconfigbitstop2.getValue();
        mconfigbitstop = SPconfigbitstop2.getValue();

        ListPreference SPmconfigparity2 = (ListPreference) findPreference("config_parity");
        //String mconfigparity = SPmconfigparity2.getValue();                    
         mconfigparity = SPmconfigparity2.getValue();

        ListPreference SPconfigfontsize2 = (ListPreference) findPreference("config_font_size");
        //String mconfigfontsize = SPconfigfontsize2.getValue();            
         mconfigfontsize = SPconfigfontsize2.getValue();

        ListPreference SPconfigconsolamode2 = (ListPreference) findPreference("config_consola_mode");
        //String mconfigconsolamode = SPconfigconsolamode2.getValue();        
        mconfigconsolamode = SPconfigconsolamode2.getValue();

        ListPreference SPconfigfindelinea2 = (ListPreference) findPreference("config_fin_delinea");
        //String mconfigfindelinea = SPconfigfindelinea2.getValue();
        mconfigfindelinea = SPconfigfindelinea2.getValue();

        TwoStatePreference SPconfigenableeco2 = (TwoStatePreference) findPreference("config_enable_eco");
        Boolean mconfigenableecoX = SPconfigenableeco2.isChecked();
        //String mconfigenableeco = String.valueOf(mconfigenableecoX);
        mconfigenableeco = String.valueOf(mconfigenableecoX);

        ListPreference SPconfigfilesave2 = (ListPreference) findPreference("config_filesave");
        //String mconfigfilesave = SPconfigfilesave2.getValue();   
        mconfigfilesave = SPconfigfilesave2.getValue();
    }
Publicación recuperada por Jorgesys
Publicación eliminada por Jorgesys
Origen Enlace
Jorgesys
  • 111.1k
  • 14
  • 55
  • 134

El problema es que estas definiendo los mismos nombres de variables dentro del metodo onCreate() por lo tanto unicamente tendran valor dentro del metodo.

Usa las variables que defines en la clase:

 public void onCreate(final Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_setup_com);

        setHasOptionsMenu( true );

        bindPreferenceSummaryToValue( findPreference( "config_baud_rate" ) );
        bindPreferenceSummaryToValue( findPreference( "config_data_bit" ) );
        bindPreferenceSummaryToValue( findPreference( "config_bit_stop" ) );
        bindPreferenceSummaryToValue( findPreference( "config_parity" ) );
        bindPreferenceSummaryToValue( findPreference( "config_flow_control" ) );
        bindPreferenceSummaryToValue( findPreference( "config_font_size" ) );
        bindPreferenceSummaryToValue( findPreference( "config_consola_mode" ) );
        bindPreferenceSummaryToValue( findPreference( "config_fin_delinea" ) );
        bindPreferenceSummaryToValue( findPreference( "config_filesave" ) );

        ListPreference SPconfigbaudrate2 = (ListPreference) findPreference("config_baud_rate");
        mconfigbaudrate = SPconfigbaudrate2.getValue();

        ListPreference SPconfigdatabit2 = (ListPreference) findPreference("config_data_bit");
        //String mconfigdatabit = SPconfigdatabit2.getValue();                      mconfigdatabit = SPconfigdatabit2.getValue();

        ListPreference SPconfigbitstop2 = (ListPreference) findPreference("config_bit_stop");
        //String mconfigbitstop = SPconfigbitstop2.getValue();
        mconfigbitstop = SPconfigbitstop2.getValue();

        ListPreference SPmconfigparity2 = (ListPreference) findPreference("config_parity");
        //String mconfigparity = SPmconfigparity2.getValue();                    
         mconfigparity = SPmconfigparity2.getValue();

        ListPreference SPconfigfontsize2 = (ListPreference) findPreference("config_font_size");
        //String mconfigfontsize = SPconfigfontsize2.getValue();            
         mconfigfontsize = SPconfigfontsize2.getValue();

        ListPreference SPconfigconsolamode2 = (ListPreference) findPreference("config_consola_mode");
        //String mconfigconsolamode = SPconfigconsolamode2.getValue();        
        mconfigconsolamode = SPconfigconsolamode2.getValue();

        ListPreference SPconfigfindelinea2 = (ListPreference) findPreference("config_fin_delinea");
        //String mconfigfindelinea = SPconfigfindelinea2.getValue();
        mconfigfindelinea = SPconfigfindelinea2.getValue();

        TwoStatePreference SPconfigenableeco2 = (TwoStatePreference) findPreference("config_enable_eco");
        Boolean mconfigenableecoX = SPconfigenableeco2.isChecked();
        //String mconfigenableeco = String.valueOf(mconfigenableecoX);
        mconfigenableeco = String.valueOf(mconfigenableecoX);

        ListPreference SPconfigfilesave2 = (ListPreference) findPreference("config_filesave");
        //String mconfigfilesave = SPconfigfilesave2.getValue();   
        mconfigfilesave = SPconfigfilesave2.getValue();
    }