0
TextView
をEditText
の入力に変換したいだけですが、機能しません。また、カスタムアレイアダプタには、Activity
ではなく、違いがあります。また、私はそれを働かせて、方向を変えましたAndroidManifest.xml
私はそれをデフォルトに戻しました。EditText
入力はもはやTextView
に変更されていません。alertDialogからtextViewにeditText入力を設定する方法
VCSのローカル履歴を使用して以前のコードに戻っても、何が起こったのかわかりません。ここに私のコードです。
class CustomAdapter extends ArrayAdapter{
public CustomAdapter(Context context, ArrayList choreText) {
super(context, R.layout.custon_listview_row, choreText);
}
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater myInflater = LayoutInflater.from(getContext());
View customView = myInflater.inflate(R.layout.custon_listview_row, parent, false);
ImageButton imageButton = (ImageButton) customView.findViewById(R.id.imageButton_ID);
final TextView textView = (TextView) customView.findViewById(R.id.textView_ID);
final EditText input = new EditText(getContext());
final AlertDialog OptionDialog = new AlertDialog.Builder(getContext()).create();
// makes textView clickable
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//what happens when textView is clicked
//final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
// put aler dialog box logic here
OptionDialog.setTitle("Enter new chore");
OptionDialog.setView(input);
input.setInputType(InputType.TYPE_CLASS_TEXT);
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
//checks if "Done" button on soft keyboard is clicked
input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId==EditorInfo.IME_ACTION_DONE){
//what happens when "Done" is clicked
textView.setText(input.getText().toString());
OptionDialog.dismiss();
}
return false;
}
});
OptionDialog.show();
}
});
imageButton.setImageResource(R.drawable.clock);
return customView;
}
}
"それは動作しません"それはどのくらい動作しますか?それはクラッシュですか、何ですか? –
それはすべての作品は、テキスト入力だけでユーザーの入力に変更されません。それは同じままです。 –
次に、(actionId == EditorInfo.IME_ACTION_DONE){//}このブロックが実行されているかどうかをチェックします。このブロック内の最初の行にログを入れて、 –