Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SharedPreferences: extends Activity crashes App

 
simone giusti
Greenhorn
Posts: 24
  • 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:

 
Swastik Dey
Rancher
Posts: 1637
6
Android 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
Greenhorn
Posts: 24
  • 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: 1637
6
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us code of ClientActivity class.
 
simone giusti
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Swastik Dey
Rancher
Posts: 1637
6
Android 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
Greenhorn
Posts: 24
  • 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