0

My code for a button click of first activity is

b.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        String text=e1.getText().toString();
        Intent i=new Intent(getApplicationContext(), editview.class);
        i.putExtra("mytext", text);
        CustomListViewAndroidExample.this.startActivity(i);
    }
});

and second activity code is

et1=(EditText)findViewById(R.id.editText1);
et1.setText(getIntent().getStringExtra("mytext"));
Steve Benett
  • 12,843
  • 7
  • 59
  • 79

2 Answers2

0

Use below code:

 @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            String text=e1.getText().toString();
            Intent i=new Intent(CustomListViewAndroidExample.this, editview.class);
            i.putExtra("mytext", text);
            startActivity(i);
        }
    });
Swetank
  • 1,577
  • 11
  • 14
0

Try getting the info as such

Intent intent = new Intent();
    intent = getIntent();
    Bundle bundle = intent.getExtras();
    language = bundle.getString("Language");

setting it as so

  language="bla";
    intent.putExtra("Language", language);
            startActivity(intent);
Jony-Y
  • 1,579
  • 1
  • 13
  • 30