• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

SharedPreferences: extends Activity crashes App  RSS feed

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to use SharedPrefs but when I extend the class App crashes.



this is logCat:

 
Rancher
Posts: 1944
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your exception is raised from a different class ClientActivity method doInBackground

Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.<init>(Handler.java:200)
at android.os.Handler.<init>(Handler.java:114)
at android.app.Activity.<init>(Activity.java:754)
at it.rockopera.SCSremote.TcpClient.<init>(TcpClient.java:60)
at it.rockopera.SCSremote.ClientActivity$ConnectTask.doInBackground(ClientActivity.java:237)
at it.rockopera.SCSremote.ClientActivity$ConnectTask.doInBackground(ClientActivity.java:231)
 
simone giusti
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks .. but ...
how can I solve it ??
do have I to extend "ClientActivity"? it crashes !!
without extending I can't have sharedpreferences available !

thanks ...
 
Swastik Dey
Rancher
Posts: 1944
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us code of ClientActivity class.
 
simone giusti
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Swastik Dey
Rancher
Posts: 1944
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change the doinbackground method like this and see if you get any difference


 
simone giusti
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help.
With this code it stops crashing but the app does not work anymore.

The app was build for connecting to telnet server and sending some commands. It stopped connecting.

Can you help me ??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!