Menu problems

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

Menu problems

Postby chippie2000 » Wed Oct 07, 2009 4:16 pm

Hey guys,

I've got a menu to display correctly... the following options are:

My Alert
About
Quit
Calculator

these all work, the calculator btn once pressed displays a new screen... now it seems to break when I add a button to that Screen... can anyone point me in the right direction please?

//code for Calc class

Code: Select all

package org.example.hello;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class Calc extends Activity {

   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.calc);
   }
}


Code: Select all
//xml file for this class
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
   <TextView 
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:text="@string/calc_text" />
       <Button
       android:id="@+id/mycalcBtn"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:text="@string/mycalcBtn"/>
</ScrollView>

chippie2000
Junior Developer
Junior Developer
 
Posts: 22
Joined: Wed Oct 07, 2009 4:11 pm

Top

Postby blackgin » Wed Oct 07, 2009 9:12 pm

Have you declared the second activity, that you show on button press, in the android manifest?
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Postby chippie2000 » Wed Oct 07, 2009 9:44 pm

Hmm I've never declared a button in that file. Only the class that belongs to the new window. How would a button declared in there look?
chippie2000
Junior Developer
Junior Developer
 
Posts: 22
Joined: Wed Oct 07, 2009 4:11 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 13 guests