از پایگاه داده استفاده نکردم...
کدی که در اکتیویتی اول دارم اینه:
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
startActivity(new Intent(activitye1.this, text.class));
}
});
btn2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
startActivity(new Intent(Activitye1.this, text.class));
}
} );
و کدی که در اکتیویتی دوم دارم اینه:
public class text extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.text);
TextView txt1 = (TextView) findViewById(R.id.textView1);
TextView txt2 = (TextView) findViewById(R.id.textView2);
TextJustify.run(((TextView) findViewById(R.id.textView2)), 305f);
//for justify textview
String displayMatn = "";
InputStream textView2 = null;
InputStream textView1 = null;
/// textView2 = نام فایل متنی و textView1 نام عنوان متن
textView2 = getResources().openRawResource(R.raw.btnyek);
textView1 = getResources().openRawResource(R.raw.itonvan);
int fileLen = 0;
try {
fileLen = textView2.available();
fileLen = textView1.available();
}
catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
byte[] fileBuffer = new byte[fileLen];
try {
textView2.read(fileBuffer);
textView1.read(fileBuffer);
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
textView2.close();
textView1.close();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
displayMatn = new String(fileBuffer);
///تنظیم متن داخل تکست ویو
txt1.setText(displayMatn);
txt2.setText(displayMatn);
......
میخوام بدونم در اکتیویتی دوم چه جوری میتونم فایل ارجاعی هر متن رو که با فشار دادن کلید مخصوص خودش نشون داده میشه، جداگانه مشخص کنم؟؟؟