프로젝트를 실행할 때 메시지 콘솔에 오류가 없지만 충돌은 계속 발생합니다. 나는 이유를 발견 할 수 없었다. 내가 묻는 유사한 질문 중 일부를 거치려고했지만 주어진 솔루션을 구현했지만 여전히 도움이되지 못했습니다. 여기 내 코드가있다. 이건 내 활동 XML입니다단순한 ListView 프로젝트가 충돌하지만 오류는 표시되지 않습니다.
package com.example.omar.quakereport;
public class Earthquakes {
private String mMagnitude;
private String mLocation;
private String mDate;
public Earthquakes(String magnitude, String location, String date){
mMagnitude = magnitude;
mLocation = location;
mDate = date;
}
public String getMagnitude(){
return mMagnitude;
}
public String getLocation(){
return mLocation;
}
public String getDate(){
return mDate;
}
:
package com.example.omar.quakereport;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
public class EarthquakeActivity extends AppCompatActivity {
ListView earthquakeListView;
ArrayList<String> earthquakes;
ArrayAdapter<String> adapter;
// public static final String LOG_TAG = EarthquakeActivity.class.getName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.earthquake_activity);
// Create a fake list of earthquake locations.
earthquakes = new ArrayList<>();
earthquakes.add("San Francisco");
earthquakes.add("London");
earthquakes.add("Tokyo");
earthquakes.add("Mexico City");
earthquakes.add("Moscow");
earthquakes.add("Rio de Janeiro");
earthquakes.add("Paris");
// Find a reference to the {@link ListView} in the layout
earthquakeListView = (ListView) findViewById(R.id.list);
// Create a new {@link ArrayAdapter} of earthquakes
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, earthquakes);
// Set the adapter on the {@link ListView}
// so the list can be populated in the user interface
earthquakeListView.setAdapter(adapter);
}
}
이
내 게터를 수용하는 클래스입니다<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
그리고 이것은 내 목록 항목 XML입니다
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
봐, 드롭 다운 메뉴에서 선택되어 있는지 "자세한 정보"를 확인하고 아무것도 검색 (즉, 어떤 필터)이 없도록하기 드롭 바로 오른쪽에있는 상자 하위. 앱에 충돌이 발생하면 거기에 뭔가가 있어야합니다. –
이것은 Udacity 과정 출신입니다. 나는 지진이 arraylist에서 지진 수업으로 옮겨지는 시점에 이르지 않았다고 가정합니까? 우리는 당신이 어떤 오류를 겪고 있는지 알아야합니다. – ShadowGod