Problem Running sample code tutorials

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Problem Running sample code tutorials

Postby flojo » Mon Mar 10, 2008 12:35 pm

Hi All! :wink:

The simple splash screen example:


in android manifest here...

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <ImageView id="@+id/splashscreen" android:layout_width="wrap_content"
  2.  
  3.  android:layout_height="fill_parent" android:src="@drawable/splash"
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


I get the following error: Error: no resource found that matches the give name (at src with the value @drawable/splash)

and in TestSplash.java i get error: Mulitple markers at this time R.id.splashscreen cannot be resolved or isn`t a field.

here...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  public void onCreate(Bundle icicle) {
  3.  
  4.         super.onCreate(icicle);
  5.  
  6.         setContentView(R.layout.main);
  7.  
  8.                splash = (ImageView) findViewById(R.id.splashscreen);
  9.  
  10.                Message msg = new Message();
  11.  
  12.                msg.what = STOPSPLASH;
  13.  
  14.                splashHandler.sendMessageDelayed(msg, SPLASHTIME);
  15.  
  16.     }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4



When the file get`s automatically generated in r.java on save it reverts to default state

Please help

Flojo
User avatar
flojo
Freshman
Freshman
 
Posts: 6
Joined: Tue Mar 04, 2008 8:51 am
Location: south africa

Top

Re: Problem Running sample code tutorials

Postby plusminus » Mon Mar 10, 2008 9:51 pm

Hello flojo,



flojo wrote:in android manifest here...

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <ImageView id="@+id/splashscreen" android:layout_width="wrap_content"
  2.  android:layout_height="fill_parent" android:src="@drawable/splash"
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

This goes to the layout :!: :!: :!:

flojo wrote:I get the following error: Error: no resource found that matches the give name (at src with the value @drawable/splash)

Did you place a image with "/res/drawable/splash.xyz" :?:

flojo wrote:and in TestSplash.java i get error: Mulitple markers at this time R.id.splashscreen cannot be resolved or isn`t a field.

here...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  public void onCreate(Bundle icicle) {
  2.         super.onCreate(icicle);
  3.         setContentView(R.layout.main);
  4.                splash = (ImageView) findViewById(R.id.splashscreen);
  5.                Message msg = new Message();
  6.                msg.what = STOPSPLASH;
  7.                splashHandler.sendMessageDelayed(msg, SPLASHTIME);
  8.     }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4



When the file get`s automatically generated in r.java on save it reverts to default state

You do not need to touch the R.java once :!:
When you are sure it doesn't get updated (turn of "automatical build").

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Typo Error

Postby flojo » Tue Mar 11, 2008 7:41 am

Hi Plusminus,

My apologies on the typing error it is in the layout folder/main.xml and not in manifest as i
indicated.

Still the same error

Later

Flojo
User avatar
flojo
Freshman
Freshman
 
Posts: 6
Joined: Tue Mar 04, 2008 8:51 am
Location: south africa

Postby kiran » Tue Mar 11, 2008 8:55 am

Did you place a image with "/res/drawable/splash.xyz"

placing the image with filename splash( splash.jpg, splash.png.....) in /res/drawable folder should solve the problem.
Inside R.java you would get
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public static final class drawable {
  2.         public static final int icon=0x7f020000;
  3.         public static final int splash=0x7f020001;
  4.     }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
after building.
:) smile it is the key that fits the lock of everybody's heart
User avatar
kiran
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Thu Nov 22, 2007 11:36 am
Location: India

Postby flojo » Tue Mar 11, 2008 9:14 am

Hi Kiran,

Thank s mill!...such a basic thing :oops:

The splash page show but i get the following error

Flojo
Attachments
splash_error.jpg
splash_error.jpg (125.82 KiB) Viewed 1426 times
User avatar
flojo
Freshman
Freshman
 
Posts: 6
Joined: Tue Mar 04, 2008 8:51 am
Location: south africa

Postby kiran » Tue Mar 11, 2008 10:03 am

Hi flojo,

in main.xml change
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  id="@+id/splashscreen"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
to
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. android:id="@+id/splashscreen"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
This is a change between m3 and m5 versions.
Last edited by kiran on Tue Mar 11, 2008 10:43 am, edited 1 time in total.
:) smile it is the key that fits the lock of everybody's heart
User avatar
kiran
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Thu Nov 22, 2007 11:36 am
Location: India

Top

Postby flojo » Tue Mar 11, 2008 10:21 am

Kiran

Respect!!

Flojo
User avatar
flojo
Freshman
Freshman
 
Posts: 6
Joined: Tue Mar 04, 2008 8:51 am
Location: south africa

Postby flojo » Tue Mar 11, 2008 10:39 am

Kiran,

When i replace the old format like you said i get the following

Error: no resource found that matches the give name (at id with the value @id/splashscreen)

Flojo
User avatar
flojo
Freshman
Freshman
 
Posts: 6
Joined: Tue Mar 04, 2008 8:51 am
Location: south africa

Postby kiran » Tue Mar 11, 2008 10:43 am

oops.. sorry.... it was a typing mistake. The plus is still there.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. android:id="@+id/splashscreen"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
+ after the @ in the id string indicates that the id should be automatically created if it does not already exist
:) smile it is the key that fits the lock of everybody's heart
User avatar
kiran
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Thu Nov 22, 2007 11:36 am
Location: India

Postby flojo » Tue Mar 11, 2008 10:59 am

Cool! Tx!

No Prob..are u entering the Google android challenge??

Flojo
User avatar
flojo
Freshman
Freshman
 
Posts: 6
Joined: Tue Mar 04, 2008 8:51 am
Location: south africa

Postby kiran » Tue Mar 11, 2008 11:11 am

Undecided... Couldn't spent much time for developing my app.. :(
:) smile it is the key that fits the lock of everybody's heart
User avatar
kiran
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Thu Nov 22, 2007 11:36 am
Location: India

Top

Return to General

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests