Button into a Tab error of xml

by Dayn » Wed, 29 Jul 2009 22:22:46 GMT


Sponsored Links
 i

I try to add buttons into a tab, but when I run my code. there are en
error in android emulator.

I think my xml file is wrong because it's designed it out of (height
and width) tab but I don't find how to add that into a tab without
error.

my code :

package m.dany.anrdoid.inertfacegraphiquevvm;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class InerfaceGraphiqueVVM extends TabActivity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);

setContentView(R.layout.tab);

final TabHost oTabHost = getTabHost();

TabSpec ts1 = oTabHost.newTabSpec("tab1");
ts1.setIndicator("Voicemail");
ts1.setContent(new Intent(this, Tab1.class));
oTabHost.addTab(ts1);

TabSpec ts2 = oTabHost.newTabSpec("tab2");
ts2.setIndicator("TAB 2");
ts2.setContent(R.id.textview2);
oTabHost.addTab(ts2);

oTabHost.setCurrentTab(0);

}
}


the xml file fot tab and following by xml file for button :


here:

<?xml version="1.0" encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

<TextView
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

</FrameLayout>
</LinearLayout>
</TabHost>



and here:


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<Button
android:id="@+id/button"
android:text="Button">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
</Button>

</LinearLayout>

Android Emulator has an error .

I'm really blocked so what the matter ?? please !

T



Button into a Tab error of xml

by Mark Murphy » Wed, 29 Jul 2009 23:17:51 GMT


 


And the error is...what?

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android 1.5 Programming Books:  http://commonsware.com/books.html 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Button into a Tab error of xml

by Dany BREARD » Wed, 29 Jul 2009 23:22:58 GMT


 he error is

emulator dislpay:

the application interface graphique has stopped unexpectedly , please try again.

in DDMS we can watch:


-29 15:19:15.558: INFO/ActivityManager(568): Start proc
m.dany.anrdoid.inertfacegraphiquevvm for activity
m.dany.anrdoid.inertfacegraphiquevvm/.InerfaceGraphiqueVVM: pid=1633 uid=10021
gids={}
07-29 15:19:15.757: DEBUG/dalvikvm(1626): LinearAlloc 0x0 used 637060 of
4194304 (15%)
07-29 15:19:16.828: DEBUG/AndroidRuntime(1633): Shutting down VM
07-29 15:19:16.828: WARN/dalvikvm(1633): threadid=3: thread exiting with
uncaught exception (group=0x4000fe70)
07-29 15:19:16.838: ERROR/AndroidRuntime(1633): Uncaught handler: thread main
exiting due to uncaught exception
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{m.dany.anrdoid.inertfacegraphiquevvm/m.dany.anrdoid.inertfacegraphiquevvm.InerfaceGraphiqueVVM}:
android.content.ActivityNotFoundException: Unable to find explicit activity
class
{m.dany.anrdoid.inertfacegraphiquevvm/m.dany.anrdoid.inertfacegraphiquevvm.Tab1};
have you declared this activity in your AndroidManifest.xml?
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.os.Handler.dispatchMessage(Handler.java:99)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.os.Looper.loop(Looper.java:123)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.app.ActivityThread.main(ActivityThread.java:3948)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
java.lang.reflect.Method.invokeNative(Native Method)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
java.lang.reflect.Method.invoke(Method.java:521)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
dalvik.system.NativeStart.main(Native Method)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): Caused by:
android.content.ActivityNotFoundException: Unable to find explicit activity
class
{m.dany.anrdoid.inertfacegraphiquevvm/m.dany.anrdoid.inertfacegraphiquevvm.Tab1};
have you declared this activity in your AndroidManifest.xml?
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1480)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.app.ActivityThread.resolveActivityInfo(ActivityThread.java:2072)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.app.LocalActivityManager.startActivity(LocalActivityManager.java:277)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:600)
07-29 15:19:16.878: ERROR/AndroidRuntime(1633): at
android.wi



Button into a Tab error of xml

by Mark Murphy » Wed, 29 Jul 2009 23:29:03 GMT


 


07-29 15:19:16.878: ERROR/AndroidRuntime(1633):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{m.dany.anrdoid.inertfacegraphiquevvm/m.dany.anrdoid.inertfacegraphiquevvm.InerfaceGraphiqueVVM}:
android.content.ActivityNotFoundException: Unable to find explicit
activity class
{m.dany.anrdoid.inertfacegraphiquevvm/m.dany.anrdoid.inertfacegraphiquevvm.Tab1};
have you declared this activity in your AndroidManifest.xml?

That seems fairly self-explanatory. Have you declared this activity in
your AndroidManifest.xml?

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android 1.5 Programming Books:  http://commonsware.com/books.html 

--~--~---------~--~----~------------~-------~--~----~



Button into a Tab error of xml

by Dany BREARD » Thu, 30 Jul 2009 15:49:27 GMT


 Hi murphy

Thank you so much, I add my new acctivity class Tab1 in the AndroidManifest.xml 
file. And now my code can launch in android;

I blocked since monday about that.

you are my hero lol.

I think is a novice error. But if I you don't find this error you can't go 
ahead.

Thanks murphy 

see you later 

Dany BREARD a French novice android develloper





_________________________________________________________________
Indit ! Des Emoticnes Djantes! Installez les dans votre Messenger !
 http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx 
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. OnCreate does not finish

Hi,

I would like to know what is going on with my app and Android system
when the onCreate() method in Application class doesn't finish.

In  onCreate() of the MyApplication extends Application class I have:

super.onCreate()
//do sth 1
log("1")
//do sth 2
log("2")
...

Usually when Android is creating the application I see 1 , 2 in my log
entries. However a few users have an issue that for 2 days Android is
keeping on restarting the app a few times, and always there is only
"1" in the log.
So the onCreate method hasn't finished.

so it must be that while creating the app Android System decided that
there are not enough resources for my app.
Is my suspicion right? How can I do sth. with this - at least catch
and log such an event in a precise and sure way.

Thanks for any help,
Tomasz Bartczak
Automatic Sleep Log.

-- 

2. SimpleAdapter is not updatable after a Filter request has been made

So I was playing around with a ListView backed by a SimpleAdapter
who's data is loaded via an async task. Now I can refill this adapter
and use the notifyDataSetChanged methods to update the listView to
display the correct contents. Ok that's cool. But then when I try to
filter the results based on keyboard input is where it gets a little
messy. Basically looking at the source, the internal SimpleFilter
seems that when making a copy will replace the mData value with the
copied list, making it impossible to update that Adapter's contents.
Is this intentional? Are filters only meant to work across static
lists or is this a bug?

-- 

3. Privatizing App-Created Directories on SD Card?

4. AsyncTask, back button and cancel(boolean)

5. C2DM Tied to Market? (e.g. will it work on non-official devices)

6. apk/application bunding

7. Could not find ***.apk!