java - Send data between two differents application using SharedPreferences -
i have 2 differents application in android. need send data 1 other one. first activity put in data value in sharedpreferences file:
sharedpreferences selector; selector = getsharedpreferences("tecnologia", context.mode_world_readable); editor editor = selector.edit(); select = (radiobutton) findviewbyid(opciones.getcheckedradiobuttonid()); switch (select.getid()) { case r.id.radio0: editor.putstring("opcion", "us"); editor.commit(); break; case r.id.radio1: editor.putstring("opcion", "uwb"); editor.commit(); break; } intent = new intent(this, serviceconexion.class); startactivity(i); finish(); in second activity wich launch check file , correct. call remote servie.
in second service (second project) read file:
try { context con = createpackagecontext( "org.gradiant.sistole.locdisplay", 0); sharedpreferences configuracion; configuracion = con.getsharedpreferences("tecnologia", mode_private); select = configuracion.getstring("opcion", "00"); } catch (namenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } but not has correct value. why?
you can't access other application data. instead can do., create file in sd card or location , access in both application.
Comments
Post a Comment