This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

android studio:“QuizActivity is stopped" (on my connected device)

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey can someone help me i’m a beginner and i’m trying to run this quizactivity. I think I have written everything down well. but the problem  is now when i want to run it on my connected device it shows “quizactivity is stopped”

and this is what been showing on the logcat >>>
device.jpg
[Thumbnail for device.jpg]
 
Saloon Keeper
Posts: 5711
144
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Next time, please don't post a screenshot - copy the stack trace of the exception and paste it in full. That way it can be quoted and searched.

I've seen that exception when the Android build system becomes confused after resource files are altered. Try doing a clean build.
 
etienne bell
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Tim Moores,

thanks for your response and information. I have only been programming java for 3 months and am trying to be really good at it. I hope I can get the help and advice I need on this forum about programming.

thank you verymuch
 
Tim Moores
Saloon Keeper
Posts: 5711
144
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does that mean the problem is solved?
 
etienne bell
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no i still get this same problem

ive coped the stack trace


E/MultiWindowProxy: getServiceInstance failed!
E/AndroidRuntime: FATAL EXCEPTION: main
   Process: android.bignerdranch.com, PID: 18865
   java.lang.RuntimeException: Unable to destroy activity {android.bignerdranch.com/android.bignerdranch.com.MainActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4149)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4168)
       at android.app.ActivityThread.access$1500(ActivityThread.java:196)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
       at android.os.Handler.dispatchMessage(Handler.java:111)
       at android.os.Looper.loop(Looper.java:210)
       at android.app.ActivityThread.main(ActivityThread.java:5982)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
    Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
       at android.content.res.HwResources.getText(HwResources.java:1458)
       at android.widget.TextView.setText(TextView.java:4581)
       at android.bignerdranch.com.MainActivity.updateQuestion(MainActivity.java:108)
       at android.bignerdranch.com.MainActivity.onDestroy(MainActivity.java:103)
       at android.app.Activity.performDestroy(Activity.java:6639)
       at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1152)
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4136)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4168) 
       at android.app.ActivityThread.access$1500(ActivityThread.java:196) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
       at android.os.Handler.dispatchMessage(Handler.java:111) 
       at android.os.Looper.loop(Looper.java:210) 
       at android.app.ActivityThread.main(ActivityThread.java:5982) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742) 
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
 
Tim Moores
Saloon Keeper
Posts: 5711
144
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:Try doing a clean build.



Have you done this?
 
Rancher
Posts: 1954
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the method signature of setText method.  If you are using int as an argument it's expecting a string resource.  For e.g. if you have a string resource in string e.g.
and if you wish to print this resource in any text field you can say setText(R.string.simple_menu_condensed);

But as per your code you saying mQuestionTextView.setText(question), and it's trying to locate a resource called question, but there is no resource mapped with the name question.

As you wish to print the value of question you have to convert it to String/CharSequence and call the overloaded method that accepts CharSequence as argument.
mQuestionTextView.setText(String.valueOf(question));
 
etienne bell
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:

Tim Moores wrote:Try doing a clean build.



Have you done this?



Yes i did try that once , it's little bit confussing i'll almost gave up on this project but that's not how it should be.
but i don't know ?...
i even tried invalidate and restart that didn't work either
 
Swastik Dey
Rancher
Posts: 1954
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try what I said?
 
etienne bell
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes !! It worked thankqu
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!