When try to set text to textview it get textview=null
I don't know why. Please note that I'm calling hesham2010
from another class.
public class StandaloneExample extends Activity {
TextView textViewContent;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.standalone_example);
textViewContent = (TextView) this.findViewById(R.id.textView); // working
textViewContent.setText("test"); // working fine
}
public void hesham2010(String titile) {
// here textview null why?
textViewContent.setText(titile);
}
other class :
public class PageCurlView extends View {
private void nextView() {
MySQLiteHelper SqlLiteInstance = new MySQLiteHelper(hesham);
SqlLiteInstance.insertForTest("تايتل","لبلب","ثثث");
SqlLiteInstance.insertForTest("تايتل التاني","5555","5555");
SqlLiteInstance.insertForTest("التالت","66666","66666");
int foreIndex = mIndex + 1;
Cursor myDataBase= SqlLiteInstance.getCurrentPageData(1);
StandaloneExample hesham55 = new StandaloneExample();
if(myDataBase.moveToFirst() && myDataBase.getCount() >= 1){
do{
hesham55.hesham2010(myDataBase.getString(0));
}while(myDataBase.moveToNext());
}
xml file :
<RelativeLayout
android:id="@+id/game_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.mystictreegames.pagecurl.PageCurlView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/dcgpagecurlPageCurlView1"
android:background="@drawable/facebook">
</com.mystictreegames.pagecurl.PageCurlView>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp"
android:drawableRight="@drawable/up"
android:drawableLeft="@drawable/down"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="جوهر كون المرء انه انسان لا يسعى الى الكمال"/>