Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
String result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sec);
et1 = (EditText) this.findViewById(R.id.editText1);
t1 = (TextView) this.findViewById(R.id.textView1);
t2 = (TextView) this.findViewById(R.id.textView2);
b1 = (Button) this.findViewById(R.id.button1);
b2 = (Button) this.findViewById(R.id.button2);
b1.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
t2.setText(et1.getText());
result = et1.getText().toString();

}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(v.getContext(),ThirdActivity.class);
startActivity(i);
}
});
}
public String value(){
return result;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

public class Text extends PagerAdapter{
 
Context context;
SecondActivity s = new SecondActivity();
private String[] textViewer = new String[]{
s.value(),
"Hai"

};
public ImageAdapter(Context context){
this.context= context;
}
 
@Override
public int getCount() {
return textViewer.length;
}
 
@Override
public boolean isViewFromObject(View view, Object object) {
return view==((TextView)object);
}
public Object instantiateItem(ViewGroup container, int position) {
TextView textView = new TextView(context);
textView.setText(textViewer[position]);
((ViewPager) container).addView(textView, 0);
return textView;
}

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView((TextView) object);
}
 
}
 
I want to the edit text value to be added in the View Pager.It is returning null value
Posted 13-Jun-13 1:41am
Edited 13-Jun-13 1:42am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I hope this link can help you visit here: http://stackoverflow.com/questions/6182906/how-to-pass-edit-text-data-in-form-of-string-to-next-activity[^]
 
If do you want to know more question you can ask with our development team of androids.
 
Android Application Developers
[^]
  Permalink  
Comments
shanmuga1509 at 13-Jun-13 6:53am
   
Actual requirement is i want to pass the edit text value to a class which extends PagerAdapter. Your solution helps me for passing the value from one activity to another activity.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 410
1 Jochen Arndt 200
2 Richard MacCutchan 135
3 DamithSL 105
4 PIEBALDconsult 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 13 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100