Portal Android - Comunidade de Desenvolvedores Android
http://www.portalandroid.org/comunidade/

Alternando entre layouts [RESOLVIDO]
http://www.portalandroid.org/comunidade/viewtopic.php?f=99&t=13310
Página 1 de 1

Autor:  hmendonca [ 15 Set 2011, 17:59 ]
Assunto do Tópico:  Alternando entre layouts [RESOLVIDO]

Pessoal, boa tarde.

Estou desenvolvendo uma aplicação que é projeto pra faculdade e ainda sou leigo no assunto. Criei os layouts da aplicação com botões e tudo mais, mas não consigo fazer a transição entre as telas, por exemplo:

TELA INICIAL -> TELA PRINCIPAL->TELA 01
TELA INICIAL -> TELA PRINCIPAL->TELA 02
TELA INICIAL -> TELA PRINCIPAL->TELA 03
TELA INICIAL -> TELA PRINCIPAL->TELA 04

depois voltando a alternância...

Me ajudem por favor...

Autor:  antunes [ 15 Set 2011, 18:43 ]
Assunto do Tópico:  Re: Alternando entre layouts

Na tela proncipal vc terá um botão pra cada outra tela!

Abraços!

Autor:  hmendonca [ 16 Set 2011, 10:36 ]
Assunto do Tópico:  Re: Alternando entre layouts

Isso mesmo... depois que que sair da tela principal, terá um botão na próxima tela que terá que voltar pra lá...

Autor:  antunes [ 16 Set 2011, 13:52 ]
Assunto do Tópico:  Re: Alternando entre layouts

No botão voltar de cada tela tem um "finish();".

Qual é a dúvida mesmo?

Abraços!

Autor:  hmendonca [ 16 Set 2011, 13:55 ]
Assunto do Tópico:  Re: Alternando entre layouts

Eu só tenho os layouts pronto... não tem código nenhum... como coloco pra funcionar os botões?

Autor:  antunes [ 16 Set 2011, 14:01 ]
Assunto do Tópico:  Re: Alternando entre layouts

Aí vc abusou!!

Olha aqui: viewtopic.php?f=7&t=28&hilit=hello
http://www.androidcompetencycenter.com/ ... -activity/

Abraços!

Autor:  hmendonca [ 16 Set 2011, 16:26 ]
Assunto do Tópico:  Re: Alternando entre layouts

Vamos lá... sua dica não resolveu...

Consegui fazer funcionar com o seguinte código:

package com.example.droidfg;

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

public class DroidFGActivity extends Activity {
       
    /** TELA MAIN - LOGIN*/ 
    public void CarregaTelaPrincipal() {
        setContentView(R.layout.main);
        Button BtnOK = (Button) findViewById(R.id.BtnOK);
        BtnOK.setOnClickListener(new View.OnClickListener(){
        public void onClick(View arg0) {
            CarregaMenu();
            }
        });
    }
   
    /** TELA PRINCIPAL*/
    public void CarregaMenu() {
        setContentView(R.layout.principal);
        Button BtnVoltar = (Button) findViewById(R.id.BtnVoltar);
        BtnVoltar.setOnClickListener(new View.OnClickListener(){
            public void onClick(View arg0) {
                CarregaTelaPrincipal();
                }
            });
    }
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        CarregaTelaPrincipal();      
    }
}


O problema é que só funciona da TELA INICIAL para a TELA PRINCIPAL, quando eu incluo outra função da TELA PRINCIPAL para a TELA2 dá e ponho pra executar, dá erro. Segue abaixo como ficou o segundo código:
package com.example.droidfg;

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

public class DroidFGActivity extends Activity {
       
    /** TELA MAIN - LOGIN*/ 
    public void CarregaTelaPrincipal() {
        setContentView(R.layout.main);
        Button BtnOK = (Button) findViewById(R.id.BtnOK);
        BtnOK.setOnClickListener(new View.OnClickListener(){
        public void onClick(View arg0) {
            CarregaMenu();
            }
        });
    }
   
    /** TELA PRINCIPAL*/
    public void CarregaMenu() {
        setContentView(R.layout.principal);
        Button BtnVoltar = (Button) findViewById(R.id.BtnVoltar);
        Button btAcademico = (Button) findViewById(R.id.btAcademico);
        BtnVoltar.setOnClickListener(new View.OnClickListener(){
            public void onClick(View arg0) {
                CarregaTelaPrincipal();
                }
            });
        btAcademico.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                CarregaTelaAcademico();
                }
            });
    }
   
    /** TELA ACADEMICO*/
    public void CarregaTelaAcademico() {
        setContentView(R.layout.academico);
        Button BtnVoltarAcademico = (Button) findViewById(R.id.BtnVoltarAcademico);
       
        BtnVoltarAcademico.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0){
                CarregaMenu();
            }
        });
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        CarregaTelaPrincipal();
    }
}

Autor:  antunes [ 16 Set 2011, 17:54 ]
Assunto do Tópico:  Re: Alternando entre layouts

Agora sim!!

Vamos lá!! O que vc tem que fazer é mais ou menos isso. Não vou postar o xml pq acho que vc já tem. Lembrando que para cada tela vc deve ter uma activity e para cada activity vc deve ter um layout.

Um exemplo de 2 activities:

Activity Main:

package com.example.droidfg;

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

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button BtnOK = (Button) findViewById(R.id.BtnOK);

        BtnOK.setOnClickListener(new View.OnClickListener(){
        public void onClick(View arg0) {
            Intent i = new Intent(getApplicationContext(), PrincipalActivity.class)
            startActivity(i);
            }
        });
    }
}
 


Activity Principal:


package com.example.droidfg;

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

public class PrincipalActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.principal);

        Button BtnVoltar = (Button) findViewById(R.id.BtnVoltar);

        BtnVoltar.setOnClickListener(new View.OnClickListener(){
            public void onClick(View arg0) {
                finish();
                }
            });
    }
}
 


E assim vai!!

Abraços!

Autor:  hmendonca [ 19 Set 2011, 19:18 ]
Assunto do Tópico:  Re: Alternando entre layouts

Antunes,

seu código não deu erro mas quando eu executo no celular dá erro e força fechamento...
o que pode ser?


package com.example.droidfg;

import android.app.Activity;
import android.content.Intent;          //  o Eclipse mandou eu criar esse !!!
import android.os.Bundle;
import android.view.*;
import android.widget.*;

public class DroidFGActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button BtnOK = (Button) findViewById(R.id.BtnOK);

        BtnOK.setOnClickListener(new View.OnClickListener(){
        public void onClick(View arg0) {
            Intent i = new Intent(getApplicationContext(), PrincipalActivity.class);
            startActivity(i);
            }
        });
    }
}
 

Autor:  antunes [ 19 Set 2011, 19:31 ]
Assunto do Tópico:  Re: Alternando entre layouts

E no emulador rodou?? Qual a linha do erro??

Posta o logcat!!

Abraços!

Autor:  hmendonca [ 20 Set 2011, 22:31 ]
Assunto do Tópico:  Re: Alternando entre layouts

Antunes, está dando esse erro quando clico em "entrar" no emulador ou no smartphone e não aparece nada no log de erro:
https://picasaweb.google.com/113845930700601251031/20DeSetembroDe2011#5654587375871396770

Após seu código, tenho que declarar algo no manifest?
Meu AndroidManifest está assim:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.droidfg"
      android:versionCode="1"
      android:versionName="1.0">

    <uses-sdk android:minSdkVersion="4" />

    <application android:icon="@drawable/icone" android:label="@string/app_name">
        <activity android:name=".DroidFGActivity"
                  android:label="@string/app_name">
   
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>

Autor:  antunes [ 20 Set 2011, 22:58 ]
Assunto do Tópico:  Re: Alternando entre layouts

Sim, faltou vc declarar sua outra activity!!

Todas as suas activities devem ser declaradas no seu manifest!!

Abraços!

Autor:  hmendonca [ 20 Set 2011, 23:53 ]
Assunto do Tópico:  Re: Alternando entre layouts

Antunes, depois que declarei as activies funcionou, valeu mesmo mas travei em outro problema... no código da Tela Principal fui incluir o código de um botão e não funcionou de novo, analise por favor o código e me diga se algo errado:

package com.example.droidfg;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.*;
import android.widget.*;

public class PrincipalActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.principal);

        Button BtnVoltar = (Button) findViewById(R.id.BtnVoltar);
        Button btAcademico = (Button) findViewById(R.id.btAcademico);
       
        btAcademico.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Intent i = new Intent(getApplicationContext(), AcademicoActivity.class);
                startActivity(i);
                }
            });

        BtnVoltar.setOnClickListener(new View.OnClickListener(){
            public void onClick(View arg0) {
                finish();
                }
            });
    }
}


Quando só está o código do Botão "Voltar" o código funciona, quando está o código do "Academico" trava... coloquei comentário no código do botão "Voltar" e não funcionou de novo, então sei que o problema está no botão "Academico".

Autor:  antunes [ 21 Set 2011, 00:06 ]
Assunto do Tópico:  Re: Alternando entre layouts

Cara.. já falei pa vc botar a tag "java" e não color para o seu código java!!!! Se continuar assim ning vai te ajudar!!

O problema deve ser pq vc não declarou seu botão no seu principal.xml!!

Abraços!

Autor:  hmendonca [ 21 Set 2011, 00:13 ]
Assunto do Tópico:  Re: Alternando entre layouts

Desculpa cara... foi mal mesmo... mas o botão está declarado, dá uma olhada, é o primeiro IMAGEBUTTON:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/degrade" android:id="@+id/relativeLayout1" android:gravity="center">
        <ImageButton android:layout_height="wrap_content" android:src="@drawable/lapis" android:layout_alignTop="@+id/imageButton4" android:layout_alignParentLeft="true" android:layout_marginLeft="21dp" android:layout_width="wrap_content" android:id="@+id/btAcademico"></ImageButton>
        <TextView android:layout_height="wrap_content" android:text="Biblioteca" android:id="@+id/textView1" android:textColor="@color/Preto_50" android:textStyle="bold" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_below="@+id/imageButton1" android:layout_alignLeft="@+id/imageButton1"></TextView>
        <ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:src="@drawable/faculdade_guararapes" android:layout_width="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true"></ImageView>
        <ImageButton android:id="@+id/imageButton5" android:layout_height="wrap_content" android:src="@drawable/cifrao" android:layout_width="wrap_content" android:layout_alignTop="@+id/imageButton1" android:layout_alignLeft="@+id/imageButton2" android:layout_alignBottom="@+id/imageButton1"></ImageButton>
        <TextView android:layout_height="wrap_content" android:text="Financeiro" android:id="@+id/TextView04" android:textColor="@color/Preto_50" android:textStyle="bold" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_below="@+id/imageButton5" android:layout_alignLeft="@+id/imageButton5"></TextView>
        <TextView android:layout_height="wrap_content" android:text="Secretaria" android:id="@+id/TextView01" android:textColor="@color/Preto_50" android:textStyle="bold" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_alignTop="@+id/TextView03" android:layout_alignLeft="@+id/imageButton4"></TextView>
        <TextView android:layout_height="wrap_content" android:text="Calendário" android:id="@+id/TextView03" android:textColor="@color/Preto_50" android:textStyle="bold" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_alignTop="@+id/TextView02" android:layout_alignLeft="@+id/imageButton2"></TextView>
        <ImageButton android:id="@+id/imageButton2" android:layout_height="wrap_content" android:src="@drawable/calandario" android:layout_width="wrap_content" android:layout_above="@+id/TextView03" android:layout_centerHorizontal="true"></ImageButton>
        <ImageButton android:id="@+id/imageButton4" android:layout_height="wrap_content" android:src="@drawable/secretaria" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_marginRight="25dp" android:layout_marginTop="29dp"></ImageButton>
        <Button android:text="Voltar" android:layout_height="wrap_content" android:id="@+id/BtnVoltar" android:layout_width="wrap_content" android:layout_centerVertical="true" android:layout_centerHorizontal="true"></Button>
        <TextView android:text="Acadêmico" android:textStyle="bold" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_height="wrap_content" android:id="@+id/TextView02" android:layout_width="wrap_content" android:textColor="@color/Preto_50" android:layout_below="@+id/btAcademico" android:layout_alignLeft="@+id/btAcademico"></TextView>
        <ImageButton android:src="@drawable/livro" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageButton1" android:layout_below="@+id/TextView02" android:layout_alignLeft="@+id/TextView02" android:layout_marginTop="20dp"></ImageButton>
        <ImageButton android:layout_width="wrap_content" android:src="@drawable/icone" android:layout_height="wrap_content" android:id="@+id/imageButton3" android:layout_alignTop="@+id/imageButton5" android:layout_alignLeft="@+id/TextView01"></ImageButton>
        <TextView android:text="FG Virtual" android:layout_height="wrap_content" android:id="@+id/TextView05" android:layout_width="wrap_content" android:textColor="@color/Preto_50" android:textAppearance="?android:attr/textAppearanceSmall" android:textStyle="bold" android:layout_alignTop="@+id/TextView04" android:layout_alignLeft="@+id/imageButton3"></TextView>
    </RelativeLayout>
 

Autor:  antunes [ 21 Set 2011, 01:13 ]
Assunto do Tópico:  Re: Alternando entre layouts

Pra xml, a tag é XML!!! Vc não lê os edits que eu faço nos seus posts???

Ahh claro.. não eh o seu botão!! Por acaso vc declarou a sua "AcademicoActivity" no manifest???

Lembra que todas as activities devem ser declaradas lá??

Abraços!

Autor:  hmendonca [ 21 Set 2011, 17:19 ]
Assunto do Tópico:  Re: Alternando entre layouts

Sim, a activity está declarada no Manisfest, em relação as TAGs é xml mesmo em minúsculo, coloquei em maiúsculo e deu erro na hora.
Segue abaixo o código do Manisfest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.droidfg"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="4" />

    <application android:icon="@drawable/icone" android:label="@string/app_name" android:allowBackup="false">
        <activity android:name=".DroidFGActivity"
                  android:label="@string/app_name">    
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.laucher" />
            </intent-filter>
        </activity>
       
        <activity android:name=".PrincipalActivity"
                  android:label="@string/app_name">    
            <intent-filter>
                <action android:name="android.intent.action.PRINCIPAL" />
                <category android:name="android.intent.category.laucher" />
            </intent-filter>
        </activity>
       
        <activity android:name=".AcademicoActivity"
                  android:label="@string/app_name">    
            <intent-filter>
                <action android:name="android.intent.action.ACADEMICO" />
                <category android:name="android.intent.category.laucher" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Autor:  hmendonca [ 24 Set 2011, 17:14 ]
Assunto do Tópico:  Re: Alternando entre layouts

E aí pessoal... Quem pode me ajudar neste problema???

Autor:  antunes [ 24 Set 2011, 17:42 ]
Assunto do Tópico:  Re: Alternando entre layouts

Tira isso:

<action android:name="android.intent.action.PRINCIPAL" />
<category android:name="android.intent.category.laucher" />


e isso:
<action android:name="android.intent.action.ACADEMICO" />
<category android:name="android.intent.category.laucher" />


que deve funcionar!!

Abraços!

Autor:  hmendonca [ 24 Set 2011, 20:09 ]
Assunto do Tópico:  Re: Alternando entre layouts

Não funcionou... deu o mesmo erro de sempre..

Autor:  antunes [ 24 Set 2011, 23:36 ]
Assunto do Tópico:  Re: Alternando entre layouts

Então posta o erro do logcat!!

Abraços!

Autor:  hmendonca [ 26 Set 2011, 17:50 ]
Assunto do Tópico:  Re: Alternando entre layouts

Antunes, toda vez que eu entro no Eclipse aparece isso no log:

Error
Mon Sep 26 15:35:06 BRT 2011
No repository found at file:/C:/ProjetosAndroid/Fgdroid/.



pode ser isso? Como resolver?

Autor:  antunes [ 26 Set 2011, 17:54 ]
Assunto do Tópico:  Re: Alternando entre layouts

De cabeça, não sei o que pode ser esse erro, só vendo mesmo.

Mas coloca o erro do logcat aqui!

Esse tópico te ajudará: viewtopic.php?f=7&t=13325

Abraços!

Autor:  hmendonca [ 26 Set 2011, 18:13 ]
Assunto do Tópico:  Re: Alternando entre layouts

Colocando pra rodar no meu Milestone 1, aparece o seguinte no logcat quando executa e dá o erro:

09-26 16:05:16.460: ERROR/dalvikvm(5695): could not disable core file generation for pid 5695: Operation not permitted
09-26 16:05:20.155: ERROR/dalvikvm(5711): could not disable core file generation for pid 5711: Operation not permitted
09-26 16:05:21.304: ERROR/dalvikvm(5719): could not disable core file generation for pid 5719: Operation not permitted
09-26 16:05:21.710: ERROR/dalvikvm(5727): could not disable core file generation for pid 5727: Operation not permitted
09-26 16:05:23.374: ERROR/dalvikvm(5738): could not disable core file generation for pid 5738: Operation not permitted
09-26 16:05:23.468: ERROR/dalvikvm(5742): could not disable core file generation for pid 5742: Operation not permitted
09-26 16:05:24.710: ERROR/ActivityThread(5742): Failed to find provider info for org.dayup.gtask.key
09-26 16:05:25.358: ERROR/dalvikvm(5761): could not disable core file generation for pid 5761: Operation not permitted
09-26 16:05:26.679: ERROR/dalvikvm(5773): could not disable core file generation for pid 5773: Operation not permitted
09-26 16:05:26.772: ERROR/dalvikvm(5781): could not disable core file generation for pid 5781: Operation not permitted
09-26 16:05:29.249: ERROR/dalvikvm(5807): could not disable core file generation for pid 5807: Operation not permitted
09-26 16:05:29.554: ERROR/dalvikvm(5815): could not disable core file generation for pid 5815: Operation not permitted
09-26 16:05:30.999: ERROR/dalvikvm(5824): could not disable core file generation for pid 5824: Operation not permitted
09-26 16:05:31.249: ERROR/dalvikvm(5832): could not disable core file generation for pid 5832: Operation not permitted
09-26 16:05:32.108: ERROR/dalvikvm(5842): could not disable core file generation for pid 5842: Operation not permitted
09-26 16:05:32.429: ERROR/dalvikvm(5852): could not disable core file generation for pid 5852: Operation not permitted
09-26 16:05:32.585: ERROR/dalvikvm(5860): could not disable core file generation for pid 5860: Operation not permitted
09-26 16:05:32.983: ERROR/dalvikvm(5870): could not disable core file generation for pid 5870: Operation not permitted
09-26 16:05:33.460: ERROR/dalvikvm(5880): could not disable core file generation for pid 5880: Operation not permitted
09-26 16:05:33.639: ERROR/dalvikvm(5888): could not disable core file generation for pid 5888: Operation not permitted
09-26 16:05:34.218: ERROR/dalvikvm(5901): could not disable core file generation for pid 5901: Operation not permitted
09-26 16:05:34.460: ERROR/dalvikvm(5912): could not disable core file generation for pid 5912: Operation not permitted
09-26 16:05:34.819: ERROR/C2DMRegistrar(29925): [C2DMReg] handleRequest caught java.net.UnknownHostException: android.clients.google.com
09-26 16:05:35.054: ERROR/ActivityThread(5912): Failed to find provider info for org.dayup.gtask.key
09-26 16:05:35.179: ERROR/dalvikvm(5927): could not disable core file generation for pid 5927: Operation not permitted
09-26 16:05:35.679: ERROR/dalvikvm(5936): could not disable core file generation for pid 5936: Operation not permitted
09-26 16:05:37.507: ERROR/dalvikvm(5961): could not disable core file generation for pid 5961: Operation not permitted
09-26 16:05:38.827: ERROR/dalvikvm(5969): could not disable core file generation for pid 5969: Operation not permitted
09-26 16:05:39.429: ERROR/dalvikvm(5977): could not disable core file generation for pid 5977: Operation not permitted
09-26 16:05:39.600: ERROR/dalvikvm(5988): could not disable core file generation for pid 5988: Operation not permitted
09-26 16:05:39.764: ERROR/ActivityThread(5977): Failed to find provider info for org.dayup.gtask.key
09-26 16:05:40.007: ERROR/HttpUtils(5977): java.net.UnknownHostException: help.dayup.org
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at java.net.InetAddress.lookupHostByName(InetAddress.java:506)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at java.net.InetAddress.getAllByName(InetAddress.java:256)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:359)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.dayup.common.HttpUtils.doHttpGet(HttpUtils.java:39)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.dayup.common.Communication.innerPull(Communication.java:121)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.dayup.common.Communication.access$0(Communication.java:104)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.dayup.common.Communication$1.doInBackground(Communication.java:85)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at org.dayup.common.Communication$1.doInBackground(Communication.java:1)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
09-26 16:05:40.007: ERROR/HttpUtils(5977):     at java.lang.Thread.run(Thread.java:1019)
09-26 16:05:40.007: ERROR/Communication(5977): Can't retrieve content from http://help.dayup.org/gtask.out?package ... height=854
09-26 16:05:40.522: ERROR/dalvikvm(5998): could not disable core file generation for pid 5998: Operation not permitted
09-26 16:05:40.796: ERROR/C2DMRegistrar(29925): [C2DMReg] handleRequest caught java.net.UnknownHostException: android.clients.google.com
09-26 16:05:41.397: ERROR/dalvikvm(6016): could not disable core file generation for pid 6016: Operation not permitted
09-26 16:05:42.796: ERROR/dalvikvm(6026): could not disable core file generation for pid 6026: Operation not permitted
09-26 16:05:44.436: ERROR/dalvikvm(6035): could not disable core file generation for pid 6035: Operation not permitted
09-26 16:05:45.327: ERROR/dalvikvm(6045): could not disable core file generation for pid 6045: Operation not permitted
09-26 16:05:45.921: ERROR/dalvikvm(6054): could not disable core file generation for pid 6054: Operation not permitted
09-26 16:05:46.882: ERROR/dalvikvm(6063): could not disable core file generation for pid 6063: Operation not permitted
09-26 16:05:48.280: ERROR/dalvikvm(6079): could not disable core file generation for pid 6079: Operation not permitted
09-26 16:05:50.264: ERROR/wpa_supplicant(4537): Ongoing Scan action...
09-26 16:05:50.288: ERROR/wpa_supplicant(4537): Ongoing Scan action...
09-26 16:05:51.874: ERROR/dalvikvm(6088): could not disable core file generation for pid 6088: Operation not permitted
09-26 16:05:52.335: ERROR/GlsClient-query(6035): requestFailed
09-26 16:05:52.335: ERROR/GlsClient-query(6035): java.net.UnknownHostException: www.google.com
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at java.net.InetAddress.lookupHostByName(InetAddress.java:506)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at java.net.InetAddress.getAllByName(InetAddress.java:256)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:359)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at aa.b.execute(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at aa.l.a(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at aa.l.execute(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at aa.l.execute(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at aa.i.h(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at aa.i.c(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at W.d.run(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at W.c.c(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at W.c.run(Unknown Source)
09-26 16:05:52.335: ERROR/GlsClient-query(6035):     at ac.b.run(Unknown Source)
09-26 16:05:52.765: ERROR/wpa_supplicant(4537): TI: Driver not initialized yet
09-26 16:06:01.882: ERROR/dalvikvm(6096): could not disable core file generation for pid 6096: Operation not permitted
09-26 16:06:08.366: ERROR/dalvikvm(6106): could not disable core file generation for pid 6106: Operation not permitted
09-26 16:06:09.858: ERROR/dalvikvm(6114): could not disable core file generation for pid 6114: Operation not permitted
09-26 16:06:10.264: ERROR/AndroidRuntime(5781): FATAL EXCEPTION: main
09-26 16:06:10.264: ERROR/AndroidRuntime(5781): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.droidfg/com.example.droidfg.PrincipalActivity}: java.lang.ClassCastException: android.widget.ImageButton
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1768)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.os.Looper.loop(Looper.java:130)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.app.ActivityThread.main(ActivityThread.java:3835)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at java.lang.reflect.Method.invokeNative(Native Method)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at java.lang.reflect.Method.invoke(Method.java:507)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at dalvik.system.NativeStart.main(Native Method)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781): Caused by: java.lang.ClassCastException: android.widget.ImageButton
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at com.example.droidfg.PrincipalActivity.onCreate(PrincipalActivity.java:16)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
09-26 16:06:10.264: ERROR/AndroidRuntime(5781):     ... 11 more
09-26 16:06:11.890: ERROR/dalvikvm(6125): could not disable core file generation for pid 6125: Operation not permitted
09-26 16:06:12.288: ERROR/dalvikvm(6154): could not disable core file generation for pid 6154: Operation not permitted
09-26 16:06:13.686: ERROR/dalvikvm(6166): could not disable core file generation for pid 6166: Operation not permitted
09-26 16:06:14.429: ERROR/dalvikvm(6178): could not disable core file generation for pid 6178: Operation not permitted
09-26 16:06:14.671: ERROR/dalvikvm(6186): could not disable core file generation for pid 6186: Operation not permitted
09-26 16:06:17.413: ERROR/dalvikvm(6201): could not disable core file generation for pid 6201: Operation not permitted
09-26 16:06:18.139: ERROR/dalvikvm(6209): could not disable core file generation for pid 6209: Operation not permitted
09-26 16:06:18.788: ERROR/dalvikvm(6221): could not disable core file generation for pid 6221: Operation not permitted
09-26 16:06:21.905: ERROR/dalvikvm(6242): could not disable core file generation for pid 6242: Operation not permitted
09-26 16:06:31.897: ERROR/dalvikvm(6250): could not disable core file generation for pid 6250: Operation not permitted


No logcat do emulador fica assim:

09-26 19:11:07.709: ERROR/AndroidRuntime(207): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.droidfg/com.example.droidfg.PrincipalActivity}: java.lang.ClassCastException: android.widget.ImageButton
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.os.Looper.loop(Looper.java:123)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.app.ActivityThread.main(ActivityThread.java:4203)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at java.lang.reflect.Method.invokeNative(Native Method)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at java.lang.reflect.Method.invoke(Method.java:521)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at dalvik.system.NativeStart.main(Native Method)
09-26 19:11:07.709: ERROR/AndroidRuntime(207): Caused by: java.lang.ClassCastException: android.widget.ImageButton
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at com.example.droidfg.PrincipalActivity.onCreate(PrincipalActivity.java:16)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     ... 11 more
09-26 16:11:12.679: ERROR/dalvikvm(6904): could not disable core file generation for pid 6904: Operation not permitted
09-26 16:11:14.077: ERROR/wpa_supplicant(4537): Ongoing Scan action...
09-26 16:11:17.202: ERROR/dalvikvm(6919): could not disable core file generation for pid 6919: Operation not permitted
09-26 16:11:21.905: ERROR/dalvikvm(6930): could not disable core file generation for pid 6930: Operation not permitted
09-26 16:11:22.343: ERROR/dalvikvm(6941): could not disable core file generation for pid 6941: Operation not permitted
09-26 16:11:31.921: ERROR/dalvikvm(6961): could not disable core file generation for pid 6961: Operation not permitted
09-26 16:11:32.475: ERROR/dalvikvm(6970): could not disable core file generation for pid 6970: Operation not permitted
09-26 16:11:33.319: ERROR/wpa_supplicant(4537): Ongoing Scan action...
09-26 16:11:33.522: ERROR/wpa_supplicant(4537): Ongoing Scan action...
09-26 16:11:36.429: ERROR/dalvikvm(6985): could not disable core file generation for pid 6985: Operation not permitted
09-26 16:11:41.913: ERROR/dalvikvm(6996): could not disable core file generation for pid 6996: Operation not permitted



Vê se isso ajuda vc a me ajudar... Abraços.

Autor:  antunes [ 26 Set 2011, 18:32 ]
Assunto do Tópico:  Re: Alternando entre layouts

Então, o problema está aí!!!

09-26 19:11:07.709: ERROR/AndroidRuntime(207): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.droidfg/com.example.droidfg.PrincipalActivity}: java.lang.ClassCastException: android.widget.ImageButton


Na linha 16 da sua PrincipalActivity:
09-26 19:11:07.709: ERROR/AndroidRuntime(207):     at com.example.droidfg.PrincipalActivity.onCreate(PrincipalActivity.java:16)


O que tem lá nessa linha???

Abraços!

Autor:  hmendonca [ 26 Set 2011, 18:40 ]
Assunto do Tópico:  Re: Alternando entre layouts

Segue o Activity completo:

package com.example.droidfg;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.*;
import android.widget.*;

public class PrincipalActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.principal);

        Button btAcademico = (Button) findViewById(R.id.btAcademico);   /** <------ AQUI É A LINHA 16*/
        Button BtnVoltar = (Button) findViewById(R.id.BtnVoltar);
               
        btAcademico.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Intent i = new Intent(getApplicationContext(), AcademicoActivity.class);
                startActivity(i);
                }
            });

        BtnVoltar.setOnClickListener(new View.OnClickListener(){
            public void onClick(View arg0) {
                finish();
                }
            });
    }
}

Autor:  antunes [ 26 Set 2011, 18:49 ]
Assunto do Tópico:  Re: Alternando entre layouts

Tá.. e vc quer instanciar um ImageButton em um Button??

<ImageButton android:layout_height="wrap_content" android:src="@drawable/lapis" android:layout_alignTop="@+id/imageButton4" android:layout_alignParentLeft="true" android:layout_marginLeft="21dp" android:layout_width="wrap_content" android:id="@+id/btAcademico"></ImageButton>


Tentou trocar o Button por ImageButton??

Mas isso se vc realmente quiser um ImageButton, senão muda o seu layout!!

Abraços!

Autor:  hmendonca [ 26 Set 2011, 18:59 ]
Assunto do Tópico:  Re: Alternando entre layouts

Antunes, troquei por um Button comum e funcionou... mas o conjunto de ImageButton (seis botões) é o meu menu principal, não tem um jeito de fazer funcionar com ImageButton?

Autor:  hmendonca [ 26 Set 2011, 19:14 ]
Assunto do Tópico:  Re: Alternando entre layouts

Antunes... Já resolvi o problema !!!

Peguei o Button comum, coloquei a imagem no background e tirei o texto... só não ficou parecido com o ImageButton por causa da borda mais a funcionalidade e aparência é a mesma e não altera meu projeto...

Muito obrigado mesmo pela ajuda, que Deus te abençoe !!!! Vou colocar como [RESOLVIDO].

Autor:  antunes [ 26 Set 2011, 20:00 ]
Assunto do Tópico:  Re: Alternando entre layouts [RESOLVIDO]

Use um ImageView que pode ser clicado como um botão!!

Página 1 de 1 Todos os Horários estão como UTC - 2 horas [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/