A weird screen with "Text" written when running Android App


#1

Here are my codes for CrimeActivity, CrimeFragment, and Crime respectively.
When I look up LogCat, there is the following error:

[quote]10-06 12:05:48.826: E/InputDispatcher(1225): channel ‘b15a4e18 com.example.crime/com.bignerdranch.crime.CrimeActivity (server)’ ~ Channel is unrecoverably broken and will be disposed!
[/quote]

and the screen shows only the image below. Some things I did was delete the menu file from the package, and there is no onOptionsItemSelected implementation anymore, because it kept giving an error when I had it (most likely because I got rid of the menu file). Can anyone please help me out with this? Thanks.

[code]import com.example.crime.R;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.os.Bundle;

public class CrimeActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_crime);
	
	FragmentManager fm = getSupportFragmentManager();
	Fragment fragment = fm.findFragmentById(R.id.fragmentContainer);
	
	if (fragment == null) {
		fragment = new CrimeFragment();
		fm.beginTransaction()
			.add(R.id.fragmentContainer, fragment)
			.commit();
	}
}

}
[/code]

[code]import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;

public class CrimeFragment extends Fragment {
private Crime mCrime;
private EditText mTitleField;
private Button mDateButton;
private CheckBox mDoneCheckBox;

@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	mCrime = new Crime();

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
	View v = inflater.inflate(R.layout.fragment_crime, parent, false);
	
	
	mTitleField = (EditText)v.findViewById(R.id.crime_title);
	mTitleField.addTextChangedListener(new TextWatcher() {
		public void onTextChanged(
				CharSequence c, int start, int before, int count) {
			mCrime.setTitle(c.toString());
			
		}
		public void beforeTextChanged(CharSequence c, int start, int count, int after) {
			// this space is intentionally set blank
	}
		
		public void afterTextChanged(Editable c) {
			// this space is intentionally set blank
			
		}

	
});
	mDateButton = (Button)v.findViewById(R.id.crime_date);
	mDateButton.setText(mCrime.getDate().toString());
	mDateButton.setEnabled(false);
	
	mDoneCheckBox = (CheckBox)v.findViewById(R.id.crime_done);
	mDoneCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
		public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
			// Set the crime's done property
			mCrime.setDone(isChecked);
		}
	});
	
	
	return v;

}

}[/code]

[code]import java.util.Date;
import java.util.UUID;

public class Crime {
private UUID mId;
private String mTitle;
private Date mDate;
private boolean mDone;

public Crime() {
	// Generate unique identifier
	mId = UUID.randomUUID();
	mDate = new Date();
}

public UUID getId() {
	return mId;
}

public String getTitle() {
	return mTitle;
}

public void setTitle(String title) {
	this.mTitle = title;
}

public Date getDate() {
	return mDate;
}

public void setDate(Date date) {
	this.mDate = date;
}

public boolean isDone() {
	return mDone;
}

public void setDone(boolean done) {
	this.mDone = done;
}

}
[/code]