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 Thu May 24, 2012 8:17 am

All times are UTC + 1 hour


 Topics   Replies   Views   Last post 
No new posts Applicazione per gestire SMS

by filippo729 on Wed May 23, 2012 9:39 pm in Sviluppo e programmazione in Android

0

18

Wed May 23, 2012 9:39 pm

filippo729

No new posts На интернет-витрине

by popowahgjfghjoiuyt on Sat May 19, 2012 2:25 pm in Amministrazione

0

17

Sat May 19, 2012 2:25 pm

popowahgjfghjoiuyt

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

[ Go to page: 1, 2, 3 ]

by ReattileGar on Fri May 18, 2012 5:27 pm in Amministrazione

27

12556

Fri May 18, 2012 5:27 pm

ReattileGar

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

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

0

27

Fri May 18, 2012 3:14 pm

Renatafe

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

49

Wed May 16, 2012 7:36 am

barnettmmolive2012




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Prima app - E iniziano i problemi :)
PostPosted: Wed May 25, 2011 6:33 pm 
Offline
User avatar

Joined: Wed May 25, 2011 6:23 pm
Posts: 5
Punti Android: ?
Ciao a tutti... Sono nuovo del forum e inizio già a chiedervi consigli :D
Ho conoscenze medie di java, programmo su windows e ho voglia di tentare una avventura con android... Quindi ho scaricato tutto quanto (SDK,JDK ed eclipse) e ho provato un po...
Dopo essere riuscito a far funzionare hello world (miracolo), ho provato a creare una app tutta mia e ho scritto il seguente codice:
Code:
package com.ilseric.rettangolo;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
import android.os.Bundle;

public class rettangolo extends Activity {
    /** Called when the activity is first created. */
   public Button calcola = new Button(this);
   public EditText base = new EditText(this);
   public EditText altezza = new EditText(this);
   public Double area;
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        base.findViewById(R.id.base);
        altezza.findViewById(R.id.altezza);
        calcola.findViewById(R.id.calcola);
        calcola.setOnClickListener(new OnClickListener() {
           public void onClick(View Click)
           {
              area = Double.parseDouble(base.getText().toString());
              area = area * Double.parseDouble(altezza.getText().toString());
              Toast.makeText(getApplicationContext(), area.toString(),Toast.LENGTH_LONG);
           }
        });
    }
   
}


L'app dovrebbe, al click sul bottone, prendere in ingresso i valori delle due edittext e mostrare un messaggio con l'area. Ma appena avvio l'emulatore e parte la mia app mi viene fuori il messaggio:
Activity com.ilseric.rettangolo has terminated. Please try again. Cosa c'è che non va nel codice??? :D


Top
 Profile  
 
 Post subject: Re: Prima app - E iniziano i problemi :)
PostPosted: Wed May 25, 2011 8:39 pm 
Offline
Moderatore
User avatar

Joined: Thu Jan 15, 2009 12:53 pm
Posts: 4653
Location: Valli di Lisciano!! (Ascoli Piceno)
Cellulare Android: HTC Desire
Operatore: Wind
Punti Android: 5239
ma usi eclipse come programma??no xchè eclipse dovrebbe avere il debugging tool che ti restituisce errore se una stringa è errata!

_________________
HTC DESIRE ROOTED (no s-off)
Clockwork recovery
InsertCoin



MOTOROLA FLIPOUT ROOTED
No recovery (ancora per poco)
Rom original deblur 1.14.2



HTC G1 U.S.A ROOTED
Caution 2.2
SPL 1.33.2005
Recovery AmonRa



***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***


Top
 Profile  
 
 Post subject: Re: Prima app - E iniziano i problemi :)
PostPosted: Thu May 26, 2011 9:05 am 
Offline
User avatar

Joined: Wed May 25, 2011 6:23 pm
Posts: 5
Punti Android: ?
Si uso eclipse ma se faccio debug o f11 parte il debug ma non capisco cosa cercare :D

[ Post scritto via dispositivo mobile ] Image


Top
 Profile  
 
 Post subject: Re: Prima app - E iniziano i problemi :)
PostPosted: Thu May 26, 2011 11:38 am 
Offline
Moderatore
User avatar

Joined: Thu Jan 15, 2009 12:53 pm
Posts: 4653
Location: Valli di Lisciano!! (Ascoli Piceno)
Cellulare Android: HTC Desire
Operatore: Wind
Punti Android: 5239
A parte il debug vero e proprio,io mi riferivo al check automatico degli errori che fa eclipse!!se c'è una stringa rossa ad esempio,c'è qualche errore nella stringa stessa!

Sent from my Motorola Flipout using Tapatalk

_________________
HTC DESIRE ROOTED (no s-off)
Clockwork recovery
InsertCoin



MOTOROLA FLIPOUT ROOTED
No recovery (ancora per poco)
Rom original deblur 1.14.2



HTC G1 U.S.A ROOTED
Caution 2.2
SPL 1.33.2005
Recovery AmonRa



***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***


Top
 Profile  
 
 Post subject: Re: Prima app - E iniziano i problemi :)
PostPosted: Thu May 26, 2011 12:13 pm 
Offline
User avatar

Joined: Wed May 25, 2011 6:23 pm
Posts: 5
Punti Android: ?
Certo... Quello che appena scrivi qualcosa e tipo ti dimentichi un ; ti da errore... Ma io riesco a far partire la app (compilarla) ma non appena la avvio sull'emulatore crasha... E volevo sapere se c'erano problemi nel codice... xk altrimenti non capisco dove posso avere sbagliato... :D


Top
 Profile  
 
 Post subject: Re: Prima app - E iniziano i problemi :)
PostPosted: Thu May 26, 2011 1:21 pm 
Offline
Moderatore
User avatar

Joined: Thu Jan 15, 2009 12:53 pm
Posts: 4653
Location: Valli di Lisciano!! (Ascoli Piceno)
Cellulare Android: HTC Desire
Operatore: Wind
Punti Android: 5239
io purtroppo di programmazione non mi intendo molto!!
posso solo chiederti qll che mi viene in mente:
-hai provato a vedere sulle compatibilià dell'app se c'è l'OS dell'emulatore?? (nel senso se l'emulatore è x android 2.2 e la compatibilità si ferma a 2.1)

_________________
HTC DESIRE ROOTED (no s-off)
Clockwork recovery
InsertCoin



MOTOROLA FLIPOUT ROOTED
No recovery (ancora per poco)
Rom original deblur 1.14.2



HTC G1 U.S.A ROOTED
Caution 2.2
SPL 1.33.2005
Recovery AmonRa



***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***


Top
 Profile  
 
 Post subject: Re: Prima app - E iniziano i problemi :)
PostPosted: Thu May 26, 2011 2:38 pm 
Offline
User avatar

Joined: Wed May 25, 2011 6:23 pm
Posts: 5
Punti Android: ?
Si ho provato anche a creare un nuovo emulatore con android 2.3.1 e il mio progetto 2.2. Non funziona... :)


Top
 Profile  
 
 Post subject: Re: Prima app - E iniziano i problemi :)
PostPosted: Mon Jun 20, 2011 2:22 pm 
Offline
Moderatore
User avatar

Joined: Thu Dec 27, 2007 3:51 pm
Posts: 986
Cellulare Android: HTC Dream
Operatore: TIM
Punti Android: 1320
Devi usare il LOG generato dal Dalvk Debug Monitor (comando ddms sulla directory tools dell'SDK) per capire che eccezione viene lanciata dalla tua applicazione.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 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.