Jump to content
martinhocosta

ajuda eclipse android

Recommended Posts

martinhocosta

boa tarde,

estou a comecar a programar para android e estou aqui com um erro que nao sei como resolver

the application androidAup(process com.exemple,androidaup)has stopped unexpectedly.

please try again.)

console

[2013-09-25 16:19:06 - androidAup] ActivityManager: Warning: Activity not started, its current task has been brought to the front

Alguem me podia ajudar ou dar umas dicas?

deixou de dar de um momento para o outro

Cumprimentos

Edited by martinhocosta

Share this post


Link to post
Share on other sites
HappyHippyHippo

apresenta aqui no fórum o output dado pelo DDMS (vista disponível no eclipse)


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites
martinhocosta

aparece isto

09-25 16:12:13.141: D/AndroidRuntime(523): Shutting down VM

09-25 16:12:13.141: W/dalvikvm(523): threadid=1: thread exiting with uncaught exception (group=0x4001d800)

09-25 16:12:13.239: E/AndroidRuntime(523): FATAL EXCEPTION: main

09-25 16:12:13.239: E/AndroidRuntime(523): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.androidaup/com.example.androidaup.MainActivity}: java.lang.NullPointerException

09-25 16:12:13.239: E/AndroidRuntime(523): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)

09-25 16:12:13.239: E/AndroidRuntime(523): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

09-25 16:12:13.239: E/AndroidRuntime(523): at android.app.ActivityThread.access$2300(ActivityThread.java:125)

09-25 16:12:13.239: E/AndroidRuntime(523): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

09-25 16:12:13.239: E/AndroidRuntime(523): at android.os.Handler.dispatchMessage(Handler.java:99)

09-25 16:12:13.239: E/AndroidRuntime(523): at android.os.Looper.loop(Looper.java:123)

09-25 16:12:13.239: E/AndroidRuntime(523): at android.app.ActivityThread.main(ActivityThread.java:4627)

09-25 16:12:13.239: E/AndroidRuntime(523): at java.lang.reflect.Method.invokeNative(Native Method)

09-25 16:12:13.239: E/AndroidRuntime(523): at java.lang.reflect.Method.invoke(Method.java:521)

09-25 16:12:13.239: E/AndroidRuntime(523): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)

09-25 16:12:13.239: E/AndroidRuntime(523): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)

09-25 16:12:13.239: E/AndroidRuntime(523): at dalvik.system.NativeStart.main(Native Method)

09-25 16:12:13.239: E/AndroidRuntime(523): Caused by: java.lang.NullPointerException

09-25 16:12:13.239: E/AndroidRuntime(523): at com.example.androidaup.MainActivity.carregaDados(MainActivity.java:137)

09-25 16:12:13.239: E/AndroidRuntime(523): at com.example.androidaup.MainActivity.onCreate(MainActivity.java:43)

09-25 16:12:13.239: E/AndroidRuntime(523): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

09-25 16:12:13.239: E/AndroidRuntime(523): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

09-25 16:12:13.239: E/AndroidRuntime(523): ... 11 more

09-25 16:17:13.588: I/Process(523): Sending signal. PID: 523 SIG: 9

Edited by martinhocosta

Share this post


Link to post
Share on other sites
HappyHippyHippo

que é isto ?

09-25 16:12:13.239: E/AndroidRuntime(523): Caused by: java.lang.NullPointerException

09-25 16:12:13.239: E/AndroidRuntime(523): at com.example.androidaup.MainActivity.carregaDados(MainActivity.java:137)


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites
martinhocosta

para carregar dados numa listView

public void carregaDados(){
	mostraDados = (ListView) findViewById(R.id.textViewcarregaDados);
	if(verificaregisto())
	{
		String [] coluna = new String[] {Key_pessoa};
		adapterLista= new SimpleCursorAdapter(this, R.layout.activity_main, cursor, coluna, new int[] {R.id.listView1});
		mostraDados.setAdapter(adapterLista);

	}
	else
	{
			alerta("Erro banco dados","nao tem cadastros");
	}
}

Share this post


Link to post
Share on other sites
HappyHippyHippo

eu perguntei o que era aquela linha e tu apresentas uma definição ?

eu quero saber tanto do que a função faz como quero saber o que a tua aplicação deverá fazer, isto é, escusas de dizer.

a única coisa que interessa para resolver o problema é que (muito provavelmente) estás a chamar a função sobre um objecto não instanciado.


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites
martinhocosta

já agora nao conhece um bom tuturial de programacao android

para fazer passagem de parametros

Share this post


Link to post
Share on other sites
bioshock

Se o método é disparado pela via de um click, experimenta:

public void carregaDados(View view){}

Relativamente à outra questão, o que é que pretendes?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.