1

I find a lot of topic about no souce found in eclipse android on forum, but I spend a 4 hours to fix it and I'm still in dead point. I don't have any problem with my sdk, beceause I have other two projects with the same method Intent to new Activities and the work correctly.

public class MainActivity extends Activity {

    private Button timer;

    protected void onCreate(Bundle contex) {
        super.onCreate(contex);
        setContentView(R.layout.activity_main);
        timer = (Button) findViewById(R.layout.activity_timer);
        timer.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent intent = new Intent(MainActivity.this,Timer.class);
            }
        }); 


    }
}

MainActivity XML :

  <ImageButton
                android:id="@+id/imageButton3"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_column="0"
                android:layout_toLeftOf="@+id/imageButton2"
                android:layout_weight="1"
                android:background="@drawable/timer_on_click"
                android:gravity="left"
                android:paddingLeft="3dip"
                android:scaleType="center"
                android:onClick="activity_timer" />

XML for new activity 'activity_timer.xml'

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <AnalogClock
        android:id="@+id/analogClock1"
        android:layout_width="202dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center" />

    <TimePicker
        android:id="@+id/timePicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" />

</LinearLayout>


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

public class Timer extends Activity {

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


}

strings res/values/strings.xml

 <string name="activity_timer">activity_timer</string>

Manifest :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.panic_button"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="12"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.panic_button.MainActivity"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
       <activity android:name="com.example.panic_button.Timer"
           android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>  
       </activity>

    </application>

</manifest>

Android compilation

Java Build Path

I try everything and I read a lot of similar topic and I still don't find any solution... I have similar projects, and they work correctly, so sdk is good, Android Manifest the same, I don't know what is wrong... I will be gratefull for any help!

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
pkruk
  • 809
  • 1
  • 7
  • 24

0 Answers0