dimanche 1 mars 2015

how to pass a String to another String variable in another class?

i have this :



@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

String urlCorrecta="";


//Si se escoge la posicion de el arreglo 0 abre la clase LasVegas
if (position == 0)
{
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
urlCorrecta = "souphttpsrc location=http://ift.tt/1CdC9SR ! multipartdemux single-stream=true ! jpegdec ! autovideosink sync=false ";


}

//Si se escoge la posicion de el arreglo 1 abre la clase LosGuayabos
else if (position == 1)

{
Intent intent = new Intent(this, LosGuayabos.class);
startActivity(intent);

urlCorrecta = "souphttpsrc location=http://ift.tt/1ArO2O0 ! multipartdemux single-stream=true ! jpegdec ! autovideosink sync=false ";

}

//Si se escoge la posicion de el arreglo 2 abre la clase RegionalNorte
else if (position == 2)

{
Intent intent = new Intent(this, RegionalNorte.class);
startActivity(intent);

urlCorrecta = "souphttpsrc location=http://ift.tt/1CdCa97 ! multipartdemux single-stream=true ! jpegdec ! autovideosink sync=false ";
}


//Si se escoge la posicion de el arreglo 3 abre la clase RegionalSur
else if (position == 3)

{
Intent intent = new Intent(this, RegionalSur.class);
startActivity(intent);

urlCorrecta = "souphttpsrc location=http://ift.tt/1ArO5cJ ! multipartdemux single-stream=true ! jpegdec ! autovideosink sync=false ";

}

}


i want to pass the value of the String urlCorrecta to the String VIDEO_IN_PIPELINE located in the class MainActivity.



public class MainActivity extends ActionBarActivity implements SurfaceHolder.Callback{




private final String VIDEO_IN_PIPELINE = VALUE OF THE STRING urlCorrecta;
private final String HOST_IP = "192.168.1.167";


}


How can i take that String from the other class to this one?


thanks very much for reading.


Aucun commentaire:

Enregistrer un commentaire