Tab view with map class

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Tab view with map class

Postby poifull » Wed Jul 01, 2009 1:09 pm

Hi! I nd help URGENTLY. I'm trying to create an app with tab host view and inside my tab i would like to display my map class. I gotten an error "Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {android.smoke/java.util.Map};" but i did declared the activity inside my AndroidManifest.xml. Here is my codes.

public class Tab extends TabActivity {
/** Called when the activity is first created. */
private TabHost mTabHost;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab);

mTabHost = getTabHost();


mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("map").setContent(new Intent(this, Map.class)));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("TAB 2").setContent(R.id.textview2));
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("TAB 3").setContent(R.id.textview3));

mTabHost.setCurrentTab(0);

}
}

Pls reply me asap. Thank you!
poifull
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Jul 01, 2009 1:01 pm

Top

help?

Postby chyll05 » Thu Jul 09, 2009 3:20 am

I also have the same problem as poifull. can you please help us?
thanks...
chyll05
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Mar 12, 2009 8:35 am

Postby arvind » Fri Jul 10, 2009 12:45 pm

Hello friends
I think I have the solution to your problems...
please look up
http://vkroz.wordpress.com/2009/07/03/p ... -tab-view/

It has worked for me...
Please post here if you could make it work!
If anyone knows how to pass data from one tab to other ... please post that code also

Thanks and Regards
Arvind
arvind
Junior Developer
Junior Developer
 
Posts: 21
Joined: Tue Jun 23, 2009 4:44 am
Location: Mumbai,India

Postby chyll05 » Sat Jul 11, 2009 7:41 am

thanks for the site it really helped me...
chyll05
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Mar 12, 2009 8:35 am

Postby vkroz » Mon Dec 14, 2009 8:16 pm

vkroz
Freshman
Freshman
 
Posts: 3
Joined: Tue Nov 24, 2009 7:36 pm

Postby matany » Sat Dec 19, 2009 5:57 am

Hi

I am very very tired for searching a solution to my problem for the past 10 days. The above code does not work under 1.5.

I have 4 tabs in TabActivity class and I also have MapActivity (Maps2.java) in different class. I tried to do the following....trying to call the Maps2.java gives me an error...

tabHost.addTab(tabHost.newTabSpec("")
.setIndicator("", getResources().getDrawable(R.drawable.icon))
.setContent(new Intent(this, Maps2.class)));

This does not work.


I would like to display my map in the third tab.

Please help. I will be sooooooooooooo happy if this works for me.....

Thanks

Yassin
matany
Experienced Developer
Experienced Developer
 
Posts: 66
Joined: Tue Dec 08, 2009 9:29 pm

Top

Postby Droid123 » Sun Dec 20, 2009 9:01 am

matany wrote:Hi

I am very very tired for searching a solution to my problem for the past 10 days. The above code does not work under 1.5.

I have 4 tabs in TabActivity class and I also have MapActivity (Maps2.java) in different class. I tried to do the following....trying to call the Maps2.java gives me an error...

tabHost.addTab(tabHost.newTabSpec("")
.setIndicator("", getResources().getDrawable(R.drawable.icon))
.setContent(new Intent(this, Maps2.class)));

This does not work.


I would like to display my map in the third tab.

Please help. I will be sooooooooooooo happy if this works for me.....

Thanks

Yassin


this works for me:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. tabHost.addTab(tabHost.newTabSpec("map")
  2.  
  3.                 .setIndicator(" ",getResources().getDrawable(R.drawable.ic_menu_more))
  4.  
  5.                 .setContent(new Intent(this, Maps2.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Postby matany » Sun Dec 20, 2009 7:16 pm

Thank you for your reply. I REALLY appreciate. It still does not work.

it says could not find my maps2.class My Maps2.class is in the same dir and same package.

Here is the error I get...




12-20 13:08:34.453: DEBUG/AndroidRuntime(865): --- registering native functions ---
12-20 13:08:34.463: INFO/jdwp(865): received file descriptor 19 from ADB
12-20 13:08:34.693: DEBUG/ddm-heap(865): Got feature list request
12-20 13:08:35.023: INFO/ActivityManager(75): Starting activity: Intent { flg=0x10000000 cmp=com.myapp/.Container }
12-20 13:08:35.073: DEBUG/AndroidRuntime(865): Shutting down VM
12-20 13:08:35.073: DEBUG/dalvikvm(865): DestroyJavaVM waiting for non-daemon threads to exit
12-20 13:08:35.093: DEBUG/dalvikvm(865): DestroyJavaVM shutting VM down
12-20 13:08:35.093: DEBUG/dalvikvm(865): HeapWorker thread shutting down
12-20 13:08:35.093: DEBUG/dalvikvm(865): HeapWorker thread has shut down
12-20 13:08:35.093: DEBUG/jdwp(865): JDWP shutting down net...
12-20 13:08:35.093: DEBUG/jdwp(865): +++ peer disconnected
12-20 13:08:35.093: INFO/dalvikvm(865): Debugger has detached; object registry had 1 entries
12-20 13:08:35.103: DEBUG/dalvikvm(865): VM cleaning up
12-20 13:08:35.163: DEBUG/dalvikvm(865): LinearAlloc 0x0 used 676436 of 4194304 (16%)
12-20 13:08:35.183: INFO/ActivityManager(75): Start proc com.myapp for activity com.myapp/.Container: pid=872 uid=10043 gids={3003, 1015}
12-20 13:08:35.233: INFO/jdwp(872): received file descriptor 11 from ADB
12-20 13:08:35.273: DEBUG/ddm-heap(872): Got feature list request
12-20 13:08:35.423: WARN/dalvikvm(872): Unable to resolve superclass of Lcom/myapp/Maps2; (24)
12-20 13:08:35.423: WARN/dalvikvm(872): Link of class 'Lcom/myapp/Maps2;' failed
12-20 13:08:35.423: ERROR/dalvikvm(872): Could not find class 'com.myapp.Maps2', referenced from method com.myapp.Container.onCreate
12-20 13:08:35.423: WARN/dalvikvm(872): VFY: unable to resolve const-class 31 (Lcom/myapp/Maps2;) in Lcom/myapp/Container;
12-20 13:08:35.423: WARN/dalvikvm(872): VFY: rejecting opcode 0x1c at 0x0031
12-20 13:08:35.423: WARN/dalvikvm(872): VFY: rejected Lcom/myapp/Container;.onCreate (Landroid/os/Bundle;)V
12-20 13:08:35.423: WARN/dalvikvm(872): Verifier rejected class Lcom/myapp/Container;
12-20 13:08:35.433: WARN/dalvikvm(872): Class init failed in newInstance call (Lcom/myapp/Container;)
12-20 13:08:35.433: DEBUG/AndroidRuntime(872): Shutting down VM
12-20 13:08:35.433: WARN/dalvikvm(872): threadid=3: thread exiting with uncaught exception (group=0x4001da28)
12-20 13:08:35.433: ERROR/AndroidRuntime(872): Uncaught handler: thread main exiting due to uncaught exception
12-20 13:08:35.443: ERROR/AndroidRuntime(872): java.lang.VerifyError: com.myapp.Container
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at java.lang.Class.newInstanceImpl(Native Method)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at java.lang.Class.newInstance(Class.java:1472)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at android.os.Looper.loop(Looper.java:123)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at android.app.ActivityThread.main(ActivityThread.java:4203)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at java.lang.reflect.Method.invokeNative(Native Method)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at java.lang.reflect.Method.invoke(Method.java:521)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
12-20 13:08:35.443: ERROR/AndroidRuntime(872): at dalvik.system.NativeStart.main(Native Method)
12-20 13:08:35.453: INFO/Process(75): Sending signal. PID: 872 SIG: 3
12-20 13:08:35.453: INFO/dalvikvm(872): threadid=7: reacting to signal 3
12-20 13:08:35.523: INFO/dalvikvm(872): Wrote stack trace to '/data/anr/traces.txt'



What am I doing wrong....

Please help, this error is driving me crazy.

THANKS ALOT

matany
matany
Experienced Developer
Experienced Developer
 
Posts: 66
Joined: Tue Dec 08, 2009 9:29 pm

Postby qlimax » Sun Dec 20, 2009 9:26 pm

have you added the map activity to the manifest xml file?
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby matany » Sun Dec 20, 2009 11:41 pm

I did put the Maps2 in the manifest file, but I still get the error.

FYI,

if I put Tabs2Activity activity that has just text label, it works, but the moment I put Maps2, I get the above error.

Thanks for your help guys..


Below is my manifest file


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Container"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Tab1Activity"></activity>
<activity android:name=".Maps2"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

</manifest>
matany
Experienced Developer
Experienced Developer
 
Posts: 66
Joined: Tue Dec 08, 2009 9:29 pm

Postby qlimax » Mon Dec 21, 2009 12:15 am

can you post your code?
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby Droid123 » Mon Dec 21, 2009 12:17 am

could you post your code too?

EDIT: Qlimax beat me to it :)
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Postby matany » Mon Dec 21, 2009 12:33 am

Ok, here it is...Thanks so much..

solved
Last edited by matany on Mon Dec 21, 2009 8:25 pm, edited 1 time in total.
matany
Experienced Developer
Experienced Developer
 
Posts: 66
Joined: Tue Dec 08, 2009 9:29 pm

Postby matany » Mon Dec 21, 2009 12:39 am

Remember,

If you run Maps2.java/MyPositionOverlay.java/map.xml by it self it will run.

If you run Container with Tabs1Activity, it will run, but the moment you try to call Maps2 in Container, it will crash.

Thanks

matany
matany
Experienced Developer
Experienced Developer
 
Posts: 66
Joined: Tue Dec 08, 2009 9:29 pm

Postby Droid123 » Mon Dec 21, 2009 1:19 am

well... all I can suggest at this point is: remove or comment out everything unneccesary from the map2 class.

It'll look like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Maps2 extends MapActivity {
  2.  
  3.  
  4.  
  5. @Override
  6.  
  7. public void onCreate(Bundle icicle) {
  8.  
  9. super.onCreate(icicle);
  10.  
  11. setContentView(R.layout.map);
  12.  
  13. }
  14.  
  15.  
  16.  
  17. @Override
  18.  
  19. protected boolean isRouteDisplayed() {
  20.  
  21. return false;
  22.  
  23. }
  24.  
  25. }
  26.  
  27.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


See if you can inflate that in the tabhost and go from there
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Top
Next

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests