2016-08-18 3 views
0

AsynTask에서 일부 변경을 한 후에 앱을 실행할 때이 오류가 발생합니다 : java.lang.RuntimeException : 활동을 시작할 수 없습니다. ComponentInfo {com.example.android.popularmovies/com.example.android.popularmovies.MainActivity} : android.view.InflateException : 이진 XML 파일 줄 # 1 : 클래스 조각을 부 풀리는 중 오류가 발생했습니다.안드로이드 인기 영화 앱에서 클래스 조각을 부 풀리는 중 오류가 발생했습니다.

이것은 activity_main.xml 파일입니다. 당신이 제공 할 수있는 어떤 도움

package com.example.android.popularmovies; 


import android.os.Bundle; 
import android.support.v7.app.ActionBarActivity; 
import android.support.v7.app.AppCompatActivity; 
import android.view.Menu; 
import android.view.MenuItem; 



public class MainActivity extends AppCompatActivity { 

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


@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    // Inflate the menu; this adds items to the action bar if it is present. 
    getMenuInflater().inflate(R.menu.menu_main, menu); 
    return true; 
} 

@Override 
public boolean onOptionsItemSelected(MenuItem item) { 
    // Handle action bar item clicks here. The action bar will 
    // automatically handle clicks on the Home/Up button, so long 
    // as you specify a parent activity in AndroidManifest.xml. 
    int id = item.getItemId(); 

    //noinspection SimplifiableIfStatement 
    if (id == R.id.action_settings) { 
     return true; 
    } 

    return super.onOptionsItemSelected(item); 
} 
} 

감사 :

<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:id="@+id/fragment" 
     android:name="com.example.android.popularmovies.MainActivityFragment" 
     tools:layout="@layout/fragment_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 

그리고 이것은 MainActivity.java 파일입니다! 이

tools:context= ".MainActivity" 

를 추가 또는 당신은 <FrameLayout> 내부 <fragment> 넣을 수 있습니다 :)

답변

0

나는 반드시 다음을 시도하고 있지 않다. 코드를 한 번 청소하십시오.