rouillip Posted July 3, 2011 Share Posted July 3, 2011 Je suis nouveau sur android et degré presque zero sur Java, car je developpe pour iphone et le web ! je voudrais que mon application (sur emulator et device) se lance sur index.html (ou main.html) quand on la démarre. Ensuite j'utilise jquery mobile pour la développer. Je penses que c'est une question un peu bête ... mais à mon niveau sur android. QUelqu'un pourrait il m'aider ? merci Link to comment Share on other sites More sharing options...
Lord Yu Posted July 4, 2011 Share Posted July 4, 2011 En gros tu souhaites qu'au démarrage, ton application lance un navigateur web avec ta page dedans ou que ta page soit intégrée à l'application ? Dans le premier cas, dans ton onCreate tu met ça: Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("http://tonsiteinternet.com"); intent.setData(uri); startActivity(intent); Dans le deuxième cas tu intègres une webview à ton application. Link to comment Share on other sites More sharing options...
rouillip Posted July 4, 2011 Author Share Posted July 4, 2011 En gros tu souhaites qu'au démarrage, ton application lance un navigateur web avec ta page dedans ou que ta page soit intégrée à l'application ? Dans le premier cas, dans ton onCreate tu met ça: Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("http://tonsiteinternet.com"); intent.setData(uri); startActivity(intent); Dans le deuxième cas tu intègres une webview à ton application. ------------------------------------------------------------------------------------------ merci pour ta suggestion, elle marche très bien si je demarre sur un site exterieur (http://www.rouillier.com/paul), par contre si j'essaye de demarrer sur le fichier index.html qui est dans mon dossier assets ("/assets/index.html") ou ("index.html") l' application se charge bien mais à l'ouverture je reçois un message : The application malmaison //nom de mon appli (process mal.malmaison) has stopped unexpectedly. Please try again Le fichier index.html est un fichier jquery mobile qui fonctionne bien sur le web et sur android quand je le lance dans le cadre d'une autre application Aurais tu une idée ? Mais je ne voudrais pas te faire perdre trop de temps Merci Link to comment Share on other sites More sharing options...
Lord Yu Posted July 6, 2011 Share Posted July 6, 2011 Ha je n'avais pas compris que tu souhaitais lancer un fichier local. J'ai trouvé ceci via Google : public class ViewWeb extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webview); WebView wv; wv = (WebView) findViewById(R.id.webView1); wv.loadUrl("file:///android_asset/aboutcertified.html"); // fails here } } Il semble que ça fonctionne. Dans ton cas tu mettras donc wv.loadUrl("file:///asset/index.html"). Voilà, tiens nous au courant ! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.