0

I need to create a reference to this particular class from a tabhost in my application. The reason im creating this reference is to access some values in this particular class. but when i create a constructor in my tabhost activity it throws an a Runtime exception saying Unable to instantiate java.lang.instantiaionexception

03-21 10:17:29.382: E/AndroidRuntime(7637): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.LiveGuardRSU/com.LiveGuardRSU.LiveGuardRSUSettingsTabHost}: java.lang.InstantiationException: com.LiveGuardRSU.LiveGuardRSUSettingsTabHost

2 Answers2

0

your activity should extends TabActivity.

sachi
  • 2,122
  • 7
  • 30
  • 46
  • thats how i have done it and this is to do something with the constructors –  Mar 21 '12 at 11:15
0

I managed to sort out my issue. what i did was i managed to set the class that contains the variables i need to access to a global class. this ii by extending Application. the only thing u need to do is just add a simple tag on you android manifest file. add the following within the application tag

<application> <android:name= "YourClass"> <the rest of ur manifest file> </application>

and when u need to access the methods or variables what you need to do is just

((YourGlobalClass)FromWhateverActivityYouNeedToAccessFrom.this.getApplication()).WhatEverYouNeedToAccess

Hope this helps :)

Cheers