I honestly have no idea what's happening but none of the events listed below are hit while debugging, how is this even possible? I don't know what other information to provide that would be useful in this scenario.
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MarkerActivity extends AppCompatActivity {
private TextView titleTv, hashtagTv, dateTv, colorTv;
private EditText test_edit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_marker);
titleTv = (TextView) findViewById(R.id.title_info);
hashtagTv = (TextView) findViewById(R.id.hashtag_info);
dateTv = (TextView) findViewById(R.id.date_info);
colorTv = (TextView) findViewById(R.id.color_info);
test_edit = (EditText) findViewById(R.id.test_edit);
test_edit.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event.getAction() == KeyEvent.KEYCODE_SPACE) {
test_edit.setText(test_edit.getText().toString() + " #");
return true;
}
return false;
}
});
test_edit.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.KEYCODE_SPACE) {
test_edit.setText(test_edit.getText().toString() + " #");
return true;
}
return false;
}
});
test_edit.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
Bundle bundle = getIntent().getExtras();
if (bundle != null && bundle.containsKey("marker_title")) {
String marker_title = bundle.getString("marker_title");
if (marker_title != null) {
MarkerModel markerModel = DatabaseHelper.get().getMarker(marker_title);
titleTv.setText("Title: " + markerModel.getTitle());
dateTv.setText("Date: " + markerModel.getDay() + "/" + markerModel.getMonth() + "/" + markerModel.getYear());
hashtagTv.setText("Hashtags: " + markerModel.getHashtags());
colorTv.setText("Color: " + markerModel.getColor());
}
}
}
}
XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/color_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="color" />
<TextView
android:id="@+id/date_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="date" />
<TextView
android:id="@+id/title_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="title" />
<TextView
android:id="@+id/hashtag_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="hashtags" />
<EditText
android:id="@+id/test_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>