java - App Stopped Working After Clicking A Button -


i extremely new java programming. started week or 2 ago. have experience turing , visual basic. please try , keep explanations simple possible. sorry if post kind of messy, first time posting here.

this src java file

    package com.example.pokethedot;      import android.support.v7.app.actionbaractivity;     import android.os.bundle;     import android.view.menu;     import android.view.menuitem;     import android.view.view;     import android.widget.button;     import android.widget.textview;      public class pokethedot extends actionbaractivity {          int counter;          button add;         textview display;         @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.activity_poke_the_dot);             counter=0;             add=(button) findviewbyid(r.id.badd);             display=(textview) findviewbyid(r.id.tvdisplay);             add.setonclicklistener(new view.onclicklistener() {                  @override                 public void onclick(view arg0) {                     // todo auto-generated method stub                     counter++;                     display.settext(counter);                  }             });         }         @override         public boolean oncreateoptionsmenu(menu menu) {             // inflate menu; adds items action bar if present.             getmenuinflater().inflate(r.menu.poke_the_dot, menu);             return true;         }          @override         public boolean onoptionsitemselected(menuitem item) {             // handle action bar item clicks here. action bar             // automatically handle clicks on home/up button, long             // specify parent activity in androidmanifest.xml.             int id = item.getitemid();             if (id == r.id.action_settings) {                 return true;             }             return super.onoptionsitemselected(item);         }     } 

this xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="fill_parent"     android:paddingbottom="@dimen/activity_vertical_margin"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     tools:context="com.thenewboston.travis.startingpoint"      android:background="@drawable/background1"     >  <textview     android:id="@+id/tvdisplay"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparenttop="true"     android:layout_centerhorizontal="true"     android:layout_margintop="20dp"     android:gravity="center"     android:text="@string/base_count"     android:textcolor="#ffffff"     android:textsize="45sp" />  <button     android:id="@+id/badd"     android:layout_width="250dp"     android:layout_height="250dp"     android:layout_centerinparent="true"     android:background="@drawable/thingy"     android:minheight="40dp"     android:minwidth="40dp" />  </relativelayout> 

this android manifest

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.pokethedot"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk         android:minsdkversion="16"         android:targetsdkversion="21" />      <application         android:allowbackup="true"         android:icon="@drawable/ptd"         android:label="@string/app_name"         android:theme="@style/apptheme"          android:logo="@drawable/ptd">         <activity             android:name=".pokethedot"             android:label="@string/app_name"              android:screenorientation="portrait"             >             <intent-filter>                 <action android:name="android.intent.action.main" />                  <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>     </application>  </manifest> 

this logcat

11-12 19:08:04.780: d/dalvikvm(698): gc_for_alloc freed 99k, 3% free 8153k/8327k, paused 34ms, total 36ms 11-12 19:08:04.780: i/dalvikvm-heap(698): grow heap (frag case) 8.800mb 829456-byte allocation 11-12 19:08:04.840: d/dalvikvm(698): gc_concurrent freed 1k, 3% free 8962k/9159k, paused 29ms+3ms, total 61ms 11-12 19:08:05.050: d/gralloc_goldfish(698): emulator without gpu emulation detected. 11-12 19:09:10.250: w/resourcetype(698): no package identifier when getting value resource number 0x00000001 11-12 19:09:10.250: d/androidruntime(698): shutting down vm 11-12 19:09:10.250: w/dalvikvm(698): threadid=1: thread exiting uncaught exception (group=0x40a13300) 11-12 19:09:10.260: e/androidruntime(698): fatal exception: main 11-12 19:09:10.260: e/androidruntime(698): android.content.res.resources$notfoundexception: string resource id #0x1 11-12 19:09:10.260: e/androidruntime(698):  @ android.content.res.resources.gettext(resources.java:229) 11-12 19:09:10.260: e/androidruntime(698):  @ android.widget.textview.settext(textview.java:3620) 11-12 19:09:10.260: e/androidruntime(698):  @ com.example.pokethedot.pokethedot$1.onclick(pokethedot.java:29) 11-12 19:09:10.260: e/androidruntime(698):  @ android.view.view.performclick(view.java:4084) 11-12 19:09:10.260: e/androidruntime(698):  @ android.view.view$performclick.run(view.java:16966) 11-12 19:09:10.260: e/androidruntime(698):  @ android.os.handler.handlecallback(handler.java:615) 11-12 19:09:10.260: e/androidruntime(698):  @ android.os.handler.dispatchmessage(handler.java:92) 11-12 19:09:10.260: e/androidruntime(698):  @ android.os.looper.loop(looper.java:137) 11-12 19:09:10.260: e/androidruntime(698):  @ android.app.activitythread.main(activitythread.java:4745) 11-12 19:09:10.260: e/androidruntime(698):  @ java.lang.reflect.method.invokenative(native method) 11-12 19:09:10.260: e/androidruntime(698):  @ java.lang.reflect.method.invoke(method.java:511) 11-12 19:09:10.260: e/androidruntime(698):  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) 11-12 19:09:10.260: e/androidruntime(698):  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 11-12 19:09:10.260: e/androidruntime(698):  @ dalvik.system.nativestart.main(native method) 11-12 19:09:23.040: e/trace(723): error opening trace file: no such file or directory (2) 11-12 19:09:23.560: d/dalvikvm(723): gc_for_alloc freed 102k, 3% free 8153k/8327k, paused 30ms, total 31ms 11-12 19:09:23.560: i/dalvikvm-heap(723): grow heap (frag case) 8.800mb 829456-byte allocation 11-12 19:09:23.610: d/dalvikvm(723): gc_concurrent freed 1k, 3% free 8962k/9159k, paused 21ms+3ms, total 50ms 11-12 19:09:23.790: d/gralloc_goldfish(723): emulator without gpu emulation detected. 11-12 19:09:24.860: w/resourcetype(723): no package identifier when getting value resource number 0x00000001 11-12 19:09:24.860: d/androidruntime(723): shutting down vm 11-12 19:09:24.860: w/dalvikvm(723): threadid=1: thread exiting uncaught exception (group=0x40a13300) 11-12 19:09:24.870: e/androidruntime(723): fatal exception: main 11-12 19:09:24.870: e/androidruntime(723): android.content.res.resources$notfoundexception: string resource id #0x1 11-12 19:09:24.870: e/androidruntime(723):  @ android.content.res.resources.gettext(resources.java:229) 11-12 19:09:24.870: e/androidruntime(723):  @ android.widget.textview.settext(textview.java:3620) 11-12 19:09:24.870: e/androidruntime(723):  @ com.example.pokethedot.pokethedot$1.onclick(pokethedot.java:29) 11-12 19:09:24.870: e/androidruntime(723):  @ android.view.view.performclick(view.java:4084) 11-12 19:09:24.870: e/androidruntime(723):  @ android.view.view$performclick.run(view.java:16966) 11-12 19:09:24.870: e/androidruntime(723):  @ android.os.handler.handlecallback(handler.java:615) 11-12 19:09:24.870: e/androidruntime(723):  @ android.os.handler.dispatchmessage(handler.java:92) 11-12 19:09:24.870: e/androidruntime(723):  @ android.os.looper.loop(looper.java:137) 11-12 19:09:24.870: e/androidruntime(723):  @ android.app.activitythread.main(activitythread.java:4745) 11-12 19:09:24.870: e/androidruntime(723):  @ java.lang.reflect.method.invokenative(native method) 11-12 19:09:24.870: e/androidruntime(723):  @ java.lang.reflect.method.invoke(method.java:511) 11-12 19:09:24.870: e/androidruntime(723):  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) 11-12 19:09:24.870: e/androidruntime(723):  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 11-12 19:09:24.870: e/androidruntime(723):  @ dalvik.system.nativestart.main(native method) 

try :

display.settext(string.valueof(counter)); 

using int parameter settext means want use string resource, in case, resource id #0x1 not exist.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -