I have this text file named params.txt which consist of:
3 WENSY WENDY PING PING CHLOE CHLOE My question is, how can I read this inputs and compare the two strings in one line? Compare Wensy and Wendy and so on..
Code:
public class MainActivity extends Activity { InputStream is=null; DataInputStream dis=null; Resources myResources = null; TextView tv=null; String someText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button verify = (Button) findViewById (R.id.verify); myResources = this.getResources(); tv = (TextView)findViewById(R.id.FileViewer); is = myResources.openRawResource(R.raw.params); dis = new DataInputStream(is); someText = null; verify.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub try{ someText=dis.readLine(); }catch(IOException ioe){ someText ="Couldn't read the file"; } tv.setText(someText); } }); } } Can I save the input text on a String variable? Or there's another simple way to do this? thankyou :))