problems with android.com school.

Put your problem here if it does not fit any of the other categories.

problems with android.com school.

Postby Mighty_Pooh » Mon Jul 23, 2012 8:59 pm

Hi there people.
Im all new to java and android development.
Im trying to learn from the android school google put up on android.com but even the first app seems to give me trouble.

Here is the app and the logcat. I hope you guys can point me in a good direction.
DisplayMessageActivity.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.example.test.program;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.widget.TextView;
  7.  
  8. public class DisplayMessageActivity extends Activity {
  9. @Override
  10. public void onCreate(Bundle savedInstanceState) {
  11.         super.onCreate(savedInstanceState);
  12.  
  13.         Intent intent = getIntent();
  14.         String message = intent.getStringExtra(Knap.EXTRA_MESSAGE);
  15.        
  16.         // Create the text view
  17.         TextView textView = new TextView(this);
  18.         textView.setTextSize(40);
  19.         textView.setText(message);
  20.        
  21.         setContentView(textView);
  22. }
  23. }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


Knap.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.example.test.program;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.Menu;
  7. import android.view.View;
  8. import android.widget.EditText;
  9.  
  10. public class Knap extends Activity {
  11.         public final static String EXTRA_MESSAGE = "com.example.test.program.MESSAGE";
  12.     @Override
  13.     public void onCreate(Bundle savedInstanceState) {
  14.         super.onCreate(savedInstanceState);
  15.         setContentView(R.layout.activity_knap);
  16.     }
  17.         /** Called whn the user selects the Send button */
  18.     public void sendMessage (View view) {
  19. Intent intent = new Intent(this, DisplayMessageActivity.class);
  20. EditText editText = (EditText) findViewById(R.id.edit_message);
  21. String message = editText.getText() .toString();
  22. intent.putExtra(EXTRA_MESSAGE, message);
  23. startActivity(intent);
  24.  
  25.  
  26.     }
  27.  
  28.  
  29.  
  30.     @Override
  31.     public boolean onCreateOptionsMenu(Menu menu) {
  32.         getMenuInflater().inflate(R.menu.activity_knap, menu);
  33.         return true;
  34.     }
  35. }
  36.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

Test Program Manifest
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  2.    package="com.example.test.program"
  3.    android:versionCode="1"
  4.    android:versionName="1.0" >
  5.  
  6.     <uses-sdk
  7.        android:minSdkVersion="8"
  8.        android:targetSdkVersion="15" />
  9.  
  10.     <application
  11.        android:icon="@drawable/ic_launcher"
  12.        android:label="@string/app_name"
  13.        android:theme="@style/AppTheme" >
  14.         <activity
  15.            android:name=".Knap"
  16.            android:label="@string/title_activity_knap" >
  17.             <intent-filter>
  18.                 <action android:name="android.intent.action.MAIN" />
  19.  
  20.                 <category android:name="android.intent.category.LAUNCHER" />
  21.             </intent-filter>
  22.         </activity>
  23.         <activity android:name="com.example.myapp.DisplayMessageActivity" />
  24.     </application>
  25.  
  26. </manifest>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


strings.xml

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <resources>
  2.  
  3.     <string name="app_name">Test Program</string>
  4.     <string name="menu_settings">Settings</string>
  5.     <string name="title_activity_knap">Knap</string>
  6.     <string name="edit_message">Besked</string>
  7.     <string name="button_send">Send</string>
  8.  
  9. </resources>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4

activity_knap.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.    android:layout_width="fill_parent"
  4.    android:layout_height="fill_parent"
  5.    android:orientation="horizontal" >
  6.         <EditText       android:id="@+id/edit_message"
  7.                         android:layout_weight="1"
  8.                         android:layout_width="0dp"
  9.                         android:layout_height="wrap_content"
  10.                                                 android:hint="@string/edit_message" />
  11.        
  12.        
  13.         <Button         android:layout_width="wrap_content"
  14.                         android:layout_height="wrap_content"
  15.                         android:text="@string/button_send"
  16.                                 android:onClick="sendMessage" />
  17.  
  18. </LinearLayout>
  19.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. 07-23 21:41:11.201: D/CLIPBOARD(28998): Hide Clipboard dialog at Starting input: finished by someone else... !
  2. 07-23 21:41:22.896: D/AndroidRuntime(28998): Shutting down VM
  3. 07-23 21:41:22.896: W/dalvikvm(28998): threadid=1: thread exiting with uncaught exception (group=0x40c5f1f8)
  4. 07-23 21:41:22.901: E/AndroidRuntime(28998): FATAL EXCEPTION: main
  5. 07-23 21:41:22.901: E/AndroidRuntime(28998): java.lang.IllegalStateException: Could not execute method of the activity
  6. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.view.View$1.onClick(View.java:3116)
  7. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.view.View.performClick(View.java:3644)
  8. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.view.View$PerformClick.run(View.java:14313)
  9. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.os.Handler.handleCallback(Handler.java:605)
  10. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.os.Handler.dispatchMessage(Handler.java:92)
  11. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.os.Looper.loop(Looper.java:137)
  12. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.app.ActivityThread.main(ActivityThread.java:4517)
  13. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at java.lang.reflect.Method.invokeNative(Native Method)
  14. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at java.lang.reflect.Method.invoke(Method.java:511)
  15. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
  16. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
  17. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at dalvik.system.NativeStart.main(Native Method)
  18. 07-23 21:41:22.901: E/AndroidRuntime(28998): Caused by: java.lang.reflect.InvocationTargetException
  19. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at java.lang.reflect.Method.invokeNative(Native Method)
  20. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at java.lang.reflect.Method.invoke(Method.java:511)
  21. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.view.View$1.onClick(View.java:3111)
  22. 07-23 21:41:22.901: E/AndroidRuntime(28998):    ... 11 more
  23. 07-23 21:41:22.901: E/AndroidRuntime(28998): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.test.program/com.example.test.program.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
  24. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
  25. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1388)
  26. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.app.Activity.startActivityForResult(Activity.java:3252)
  27. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at android.app.Activity.startActivity(Activity.java:3359)
  28. 07-23 21:41:22.901: E/AndroidRuntime(28998):    at com.example.test.program.Knap.sendMessage(Knap.java:23)
  29. 07-23 21:41:22.901: E/AndroidRuntime(28998):    ... 14 more
  30.  
Parsed in 0.048 seconds, using GeSHi 1.0.8.4
Mighty_Pooh
Freshman
Freshman
 
Posts: 2
Joined: Mon Jul 23, 2012 8:35 pm

Top

Re: problems with android.com school.

Postby Mighty_Pooh » Tue Jul 24, 2012 2:34 pm

I just saw the So you are new to android sticky.

I would very much like to learn java while i program android apps instead of making some random java programs.
The problem with going through java first is that i dont see the need to play aroud with it.

Does anyone know the android.com school thing and know if it is sufficient or should i just go the long way learning java first.?
Mighty_Pooh
Freshman
Freshman
 
Posts: 2
Joined: Mon Jul 23, 2012 8:35 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 9 guests