Problem with AndroidManifest.xml

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Problem with AndroidManifest.xml

Postby blueWater » Sat Dec 26, 2009 7:41 am

Hello everybody!

I am trying, but without result to do the same like in the book Hello Android by Ed Burnette.
If someone have this book please look page 44. I do the same like in the book, so I wonder if my emulator is not configured propertly. When I add one more <activity> to manifest.xml. emulator dont respond on change..
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="org.example.sudoku"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Sudoku"
                  android:label="@string/app_name">
                 <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".About"
                android:label="@string/about_title"
                android:theme="@android:style/Theme.Dialog">
                </activity>                 
    </application>
    <uses-sdk android:minSdkVersion="6" />

</manifest>

Here is more code:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView>
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:padding="10dip">
   <TextView>
      android:id="@+id/about_content"
      android:layout_width="wrap_content"
       android:layout_height="wrap_content"
      android:text="@string/about_text"
   </TextView>
</ScrollView>



Code: Select all
package org.example.sudoku;

import android.app.Activity;
import android.os.Bundle;

public class About extends Activity{
   @Override
   protected void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
      setContentView(R.layout.about);
   }

}



Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Sudoku</string>
    <string name="main_title">Android Sudoku</string>
    <string name="continue_label">Continue</string>
    <string name="new_game_label">New Game</string>
    <string name="about_label">About</string>
    <string name="about_title">About Android Sudoku</string>
    <string name="about_text">\
    Sudoku is a logic-based number placement puzzle.
    Starting with the partially completed 9x9 grid, the
    objective is to fill the grid so that each
    row, each column, and each of the 3x3 boxes
    (also called <i>blocks</i>)contains the digits
    1 to 9 exactly once.
    </string>
    <string name="exit_label">Exit</string>
</resources>



Code: Select all
package org.example.sudoku;

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


public class Sudoku extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //set up listeners for all the buttons
        View continueButton =this.findViewById(R.id.continue_button);
        continueButton.setOnClickListener(this);
        View newButton =this.findViewById(R.id.new_button);
        newButton.setOnClickListener(this);
        View aboutButton =this.findViewById(R.id.about_button);
        aboutButton.setOnClickListener(this);
        View exitButton =this.findViewById(R.id.exit_button);
        exitButton.setOnClickListener(this);
       
    }

   @Override
   public void onClick(View v) {
      switch (v.getId()){
      case R.id.about_button:
         Intent i = new Intent(this,About.class);
         startActivity(i);
         break;
         
      case R.id.continue_button:
         Intent j = new Intent(this,About.class);
         startActivity(j);
         break;
         
      case R.id.new_button:
         Intent k = new Intent(this,About.class);
         startActivity(k);
         break;
         
      case R.id.exit_button:
         Intent p = new Intent(this,About.class);
         startActivity(p);
         break;
         
      }
      
   }
}


Please help!
Thanks for trying!
blueWater
Freshman
Freshman
 
Posts: 8
Joined: Sat Dec 26, 2009 7:21 am
Location: Sweden

Top

Postby achie1266 » Sat Dec 26, 2009 9:39 am

Hey buddy,

I donot have the book that you are talking about. I could not find any problem in the manifest either. Do you mind posting your Sudoku and About classes[that are mentioned in manifest] and their layout files.

That will help give us a better idea of what you are trying to do and what the problem is.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby blueWater » Sat Dec 26, 2009 11:06 am

Hello!
Thanks for answering! I am going crazy, not solving it.
Here is, I think the last file(tel me if something is missing).
I have a feeling that it has to do something with emulator. Is there some short code/way to test if emulator is woking propertly with sdk?
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:background="@color/background"
   android:layout_height="fill_parent"
   android:layout_width="fill_parent"
   android:padding="15dip"
   android:orientation="horizontal">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:paddingLeft="20dip"
    android:paddingRight="20dip">
<TextView 
   android:text="@string/main_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginBottom="20dip"
    android:textSize="24.5sp"/>
<TableLayout
   android:layout_height="wrap_content"
   android:layout_width="wrap_content"
   android:gravity="center"
   android:stretchColumns="*">
<TableRow>
    <Button
      android:id="@+id/continue_button"
       android:text="@string/continue_label"
       />
      <Button 
       android:id="@+id/new_button"
       android:text="@string/new_game_label"
       />
</TableRow>
<TableRow>
      <Button 
       android:id="@+id/about_button"
       android:text="@string/about_label"
       />
      <Button
       android:id="@+id/exit_button"
       android:text="@string/exit_label"
       />
    </TableRow>
    </TableLayout>
    </LinearLayout>
</LinearLayout>


I will send log cat, now somethings wrong so I can not get the last run time. But I will send it as sonn as possible.
Thanks a lot for helping!
blueWater
Freshman
Freshman
 
Posts: 8
Joined: Sat Dec 26, 2009 7:21 am
Location: Sweden

Postby achie1266 » Sat Dec 26, 2009 6:42 pm

augh i fell asleep after asking you the question...
looks like you added the code after i asked u..ty
i will look at it right away
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby achie1266 » Sat Dec 26, 2009 7:04 pm

the problem is with the layout of your about file.
You did not close the tags properly. The attributes should be given to the layouts.
You should have observed the difference in the color coding if you are using eclipse. Change it to something like this.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <ScrollView
  4.  
  5.   xmlns:android="http://schemas.android.com/apk/res/android"
  6.  
  7.   android:layout_width="wrap_content"
  8.  
  9.   android:layout_height="fill_parent"
  10.  
  11.   android:padding="10dip">
  12.  
  13.    <TextView
  14.  
  15.      android:id="@+id/about_content"
  16.  
  17.      android:layout_width="wrap_content"
  18.  
  19.       android:layout_height="wrap_content"
  20.  
  21.      android:text="@string/about_text" >
  22.  
  23.    </TextView>
  24.  
  25. </ScrollView>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4
gl
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

SOLVED

Postby blueWater » Sun Dec 27, 2009 6:36 am

THANK YOU!

I can not belive that something like this was wrong. Stupid misstake.... And I was sitting and trying to solve problem somewhere else in project.. :(

Thanks again!

ps I wonder if misstakes like this is ordinary.. :?:
thank you my friend
blueWater
Freshman
Freshman
 
Posts: 8
Joined: Sat Dec 26, 2009 7:21 am
Location: Sweden

Top

Re: SOLVED

Postby achie1266 » Sun Dec 27, 2009 7:25 am

blueWater wrote:THANK YOU!

I can not belive that something like this was wrong. Stupid misstake.... And I was sitting and trying to solve problem somewhere else in project.. :(

Thanks again!

ps I wonder if misstakes like this is ordinary.. :?:
thank you my friend

np at all..

I guess every once in a while we do those and overlook them just because we do not expect ourselves to be doing that. hey.... but logcat is there for us ;)

gl with the game
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 10 guests