Source Not Found Error

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

Source Not Found Error

Postby ashywood » Thu Apr 30, 2009 3:39 am

Hey All,

I'm working on my first app and I've come to a hurdle. When I launch the app, I get nothing but a blank app screen.

My Class File Editor message gives me the following:

"Source Not Found"
The Jar of this class belongs to container Android '1.5' which does not allow modifications to source attachments on its entries.

Here's my java code:

package com.example.newapp;

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

public class NewApp extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);


And here's my XML:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.newapp"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=". NewApp"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="6dip" android:background="@drawable/titleuiportrait">

<Button android:id="@+id/getnewchar" android:text="Touch!"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:background="@drawable/miniplay_button" android:textSize="24sp"
android:textColor="#FFFFFF" android:clickable="true" android:hint="Get a new character"/>
</RelativeLayout>
</manifest>


Thanks for any help you can give. If this is in the wrong category, my apologies in advance.
ashywood
Freshman
Freshman
 
Posts: 5
Joined: Tue Apr 28, 2009 2:34 am

Top

Postby wiederke » Thu Apr 30, 2009 12:03 pm

Hi,

don't put your layout defintion <RelativeLayout> in your manifest file. Put it in a separate layout file in the res/layout directory. Set this layout in the onCreate method of your Activity using setContentView.


Cheers,

Torsten
wiederke
Experienced Developer
Experienced Developer
 
Posts: 72
Joined: Mon Mar 02, 2009 6:46 pm
Location: Germany

Postby ashywood » Fri May 08, 2009 2:53 pm

Thank you, very much. I'm sorry to say though I did move my layout xml code out of my manifest, and created separate layouts....it does the same thing. Am I doing something wrong?

I posted a more detailed explanation of the issue. I appreciate your help and thanks for responding to my post.

Here's an example of my code:

package com.testexample.new;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;


public class testexample extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

first();
}
void first()
{

setContentView(R.layout.main);

Button menu_button = (Button)findViewById(R.id.menubttn);

menu_button.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v){state_select();
}
}
);
}

void state_select()
{
setContentView(R.layout.selection);
}
}
ashywood
Freshman
Freshman
 
Posts: 5
Joined: Tue Apr 28, 2009 2:34 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 10 guests