2012-04-27 2 views
0

인스턴스 (내 친구가 레이아웃을 한 이후,하지만 난 핵심 코딩을, 우리는 다른 프로젝트에서 할)오류 : 클래스는 내가 다른 프로젝트에서 일부 자바와 XML 파일을 복사

어떻게 든 내가 구현할 때 수 없습니다 (클래스를 인스턴스화 할 수 없습니다) 내 코드에 레이아웃, 나는 모든 패키지 경로를 수정, 새로 고쳐 그것을 청소, 생성자가 공용 (분명히) 있는지 확인하지만 XML 여전히 나에게 오류를 제공합니다.

이클립스를 다시 시작한 후에 프로젝트가 어떻게 든 잘 돌아 간다. 아무런 실패없이 logcat에서 오류없이 실행되지만 내 이클립스 파일의 friend_schedule.xml 파일을 확인하면 오류가 발생하지만 계속 제공한다. 나중에 어떤 효과가 있을지 궁금한가요? 여기

는 자바 인스턴스화 할 수없는 파일입니다 :

package cal.endar; 
public class FriendSchedule extends LinearLayout 
{ 
public FriendSchedule(Context con) 
{ 
    super(con); 
    initComponent(con); 
} 

public FriendSchedule(Context con, AttributeSet att) 
{ 
    super(con, att); 
    initComponent(con); 
} 

public void initComponent(Context con) 
{ 
    LayoutInflater inf=LayoutInflater.from(con); 
    View v=inf.inflate(R.layout.main, null,false); 

    //View v=inf.inflate(R.layout.daily_layout, null,false); 
    //View v=inf.inflate(R.layout.weekly_layout, null,false); 
    addView(v); 
    v.getLayoutParams().height=LayoutParams.MATCH_PARENT; 
    LinearLayout.LayoutParams lp=(LinearLayout.LayoutParams) v.getLayoutParams(); 
    lp.weight=1; 
} 

public void onClick(View v) 
{ 
    v.setBackgroundResource(R.drawable.app_list_selected); 
} 
} 

그리고 이것은 내 friend_schedule.xml입니다 : 난 내 일식이 한 번 더 다시 시작

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

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:padding="5dp"> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="45dp" 
     android:layout_height="45dp" 
     android:src="@drawable/ic_launcher" /> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_marginLeft="5dp" 
     android:layout_weight="0.13" 
     android:gravity="left|center" 
     android:text="My Name" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 
</LinearLayout> 

<cal.endar.FriendSchedule 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" android:layout_weight="1"/> 

</LinearLayout> 
+0

XML을 게시 할 수 있습니까? 클래스의 패키지가 동일한 지 확인하십시오. – Rajesh

+0

@kielels : 페이지 이름과 XML을 포함한 –

+0

을 포함한 FriendSchedule의 전체 코드로 게시물을 편집하고 물론 FriendSchedule 패키지 이름 ... 응답 btw에 대해 ... – Kioels

답변

0

프로젝트는 잘 실행 관리 어떤 오류도없이 (나는 왜 이런 일이 있었는지 모르겠다. 그리고 이것에 대한 좋은 답변이 없다)

어쨌든, 당신의 답변에 감사드립니다 ...

관련 문제