Android-dev.it Community

 
Annunci

:arrow: Benvenuto!, se non sei ancora un utente registrato: puoi registrati qui, oppure effettua il login
:arrow: Apri un forum sul tuo nuovo smartphone Android e collabora con noi! (dettagli)

www.agendadigitale.org
Image


Sponsor
It is currently Fri May 18, 2012 4:27 pm

All times are UTC + 1 hour


 Topics   Replies   Views   Last post 
No new posts Новый: базы для хрумера - профессиональный софт для СЕО.

by Renatafe on Fri May 18, 2012 3:14 pm in Amministrazione

0

2

Fri May 18, 2012 3:14 pm

Renatafe

No new posts Apri un forum sul tuo nuovo smartphone Android!

[ Go to page: 1, 2, 3 ]

by MYMNTWEME on Fri May 18, 2012 12:01 pm in Amministrazione

26

12406

Fri May 18, 2012 12:01 pm

MYMNTWEME

No new posts Pace is undoubtedly the vital affordable Jerseys Wholesale d

by barnettmmolive2012 on Wed May 16, 2012 7:36 am in Amministrazione

1

44

Wed May 16, 2012 7:36 am

barnettmmolive2012

No new posts Problema di compatibilità app

by deran on Tue May 15, 2012 10:44 am in Sviluppo e programmazione in Android

4

186

Tue May 15, 2012 10:44 am

deran

No new posts Applicazione inserimento eventi

by mauro21 on Mon May 14, 2012 9:20 pm in Sviluppo e programmazione in Android

0

22

Mon May 14, 2012 9:20 pm

mauro21




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Alcune funzioni android
PostPosted: Wed Dec 07, 2011 2:33 pm 
Offline
User avatar

Joined: Wed Nov 23, 2011 8:57 am
Posts: 3
Operatore: Wind
Punti Android: ?
Ciao a tutti, sono nuovo.
Spero mi possiate aiutare, sto creando un app android in cui devo inserire due bottoni e a questi bottoni devo collegare due funzioni distinte: una mi deve aprire le mappe con un indirizzo prefissato e l'altra mi deve chiamare un numero anche questo preimpostato. Quel che mi servirebbe sapere sono le due funzioni per aprire le mappe e per chiamare. Potete aiutarmi?
Ho cercato nel forum ma non mi sembra di aver trovato quel che cercavo, se così non fosse mi scuso e se poteste almeno reindirizzarmi nel post giusto vi sarei grato.
Grazie


Top
 Profile  
 
 Post subject: Re: Alcune funzioni android
PostPosted: Wed Feb 08, 2012 4:24 pm 
Offline
Moderatore
User avatar

Joined: Thu Dec 27, 2007 3:51 pm
Posts: 986
Cellulare Android: HTC Dream
Operatore: TIM
Punti Android: 1320
Ciao,
per iniiziare una chiamata voce da un'applicazione Android verso un numero di telefono specifico, puoi usare l'intent ACTION.CALL:
Code:
String url = "tel:123456789";     
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));

Per aprire una mappa di google map, puoi usare una WebView con la URL della mappa.


Top
 Profile  
 
 Post subject: Re: Alcune funzioni android
PostPosted: Wed Feb 08, 2012 4:26 pm 
Offline
Moderatore
User avatar

Joined: Thu Dec 27, 2007 3:51 pm
Posts: 986
Cellulare Android: HTC Dream
Operatore: TIM
Punti Android: 1320
Aggiungo...
- ovviamente la tua applicazione deve avere i permessi per fare la chiamata:
Code:
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>

- è opportuno gestire le possibili eccezioni con try/catch, es:
Code:
private void call() {
    try {
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:123456789"));
        startActivity(callIntent);
    } catch (ActivityNotFoundException e) {
        Log.e("helloandroid dialing example", "Call failed", e);
    }
}


Top
 Profile  
 
 Post subject: Re: Alcune funzioni android
PostPosted: Wed Feb 08, 2012 5:50 pm 
Offline
User avatar

Joined: Wed Nov 23, 2011 8:57 am
Posts: 3
Operatore: Wind
Punti Android: ?
Ti ringrazio per avermi risposto. Purtroppo per quanto riguarda le mappe dovrei aprire proprio l'applicazione delle mappe, però mi sembra che non tutti i telefonini android hanno l'applicazione Maps, quindi credo che appena trovo l'istruzione per aprire l'applicazione, faccio un try/catch, in cui inserisco nel try l'apertura delle mappe e nel catch invece l'apertura del link a google maps(so che non è molto elegante, ma a mali estremi...).
Grazie ancora


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
phpBB SEO

All trademarks and logos used in this site are of properties of their respective owners.