File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Android Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Android" Watch "Android" New topic
Author

Android

shanmugi try
Greenhorn

Joined: Jun 04, 2013
Posts: 3
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 the edit text value to be added in the View Pager.It is returning null value.Actual requirement is i want to pass the edit text value to a class which extends PagerAdapter
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Hi Shanmugi,

Welcome to the Ranch! When posting code, please UseCodeTags (<- click that link). It will make it a lot easier to read. I also removed the duplicate post.

I tried looking at your code and it is just not readable in the state it is in now, and the question isn't very clear either. Could you re-post the code you are having trouble with (just the parts with the issue - and don't forget to UseCodeTags ;) )? Then restate the problem a different way?


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Android