Please can anyone give me the example for this "I have some edit text after doing entry in these user will click on save button then show a listview with first of edittext value with first character and when click on list view item then show those those edit text value into different-2 textview of new activity" plz help me in this.
3 Answers
public void onClick (View view) {
Intent intent = new Intent (this,display.class);
RelativeLayout relativeLayout = (RelativeLayout) view.getParent();
TextView textView = (TextView) relativeLayout.findViewById(R.id.textView1);
// TextView textView=(TextView) findViewById(R.id.textView1); for single //textview we use this
String message = textView.getText().toString();
intent.putExtra(EXTRA_MESSAGE,message);
startActivity(intent);
}
displaly.java
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.display);
// Get the message from the intent
Intent intent = getIntent();
String message = intent.getStringExtra(Listd.EXTRA_MESSAGE);
// Create the text view
EditText editText = new EditText(this);
editText.setTextSize(40);
editText.setText(message);
// Set the text view as the activity layout
setContentView(editText);
}
hope u understand from above code

- 420
- 3
- 13
You can pass value to another Activity on listView item Click as:
ListView list_view = (ListView)findViewById(R.id.listvv);
list_view.setAdapter(adapter); //set adapter here
list_view.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView parent, View view, int position, long id)
{
try
{
EditText edttx = (EditText)view.findViewById(R.id.txtviewtxt);
String edttxtxtx = edttx.getText().toString();
Intent i = new Intent(YouCurentActivity.this, New_Activity.class);
i.putExtra("txtx", edttxtxtx);
startActivity(i);
}
catch(Exception ex)
{
}
}
});
In New_Activity.class onCreate:
Bundle extras = getIntent().getExtras();
String strvalue= extras.getString("txtx");

- 132,198
- 53
- 198
- 213
I have some edit text after doing entry in these user will click on save button then show a listview with first of edittext value with first character
=> As you want to display only one line item in your ListView, ArrayAdapter suits best otherwise you have to create custom adapter for displaying custom layout item for your ListView.
And yes, whenever you click on Save button, dont forget to add the current entry in Array/ArrayList and notifyDataSetChanged()
to notify adapter about changes in data.
when click on list view item then show those those edit text value into different-2 textview of new activity
=> setOnItemClickListener() help you out.

- 1
- 1

- 127,700
- 71
- 241
- 295
-
1Those who have downvoted, can you please keep courtesy to leave reason behind it atleast. – Paresh Mayani Jun 27 '12 at 11:07