Issue
I have a problem when I want to use setText but when it is called directly on onCreate it can't?
This is my method:
public void onSendData(View view) {
long seek = videoView.getCurrentPosition();
WritableMap args = Arguments.createMap();
args.putInt("index", index);
args.putInt("seek", (int) seek);
args.putString("type", "paused");
args.putString("name", playingVideo.getString("name"));
args.putString("category_name", playingVideo.getString("category_name"));
args.putString("date", playingVideo.getString("date"));
sendEvent(reactContext, "onSendData", args);
textName.setText(playingVideo.getString("name") + " " + playingVideo.getString("category_name"));
textDate.setText(playingVideo.getString("date"));
textCustomerName.setText(playingVideo.getString("customer_name"));
textEstimate.setText(playingVideo.getString("estimate"));
textPaid.setText(playingVideo.getString("paid"));
textPrice.setText(playingVideo.getString("price"));
textAddress.setText(playingVideo.getString("address"));
textLongAddress.setText(playingVideo.getString("long_address"));
}
And this is the code when I call on the onCreate lifecycle:
public void onCreate() {
super.onCreate();
onSendData();
........
.....
}
Please help, thank you very much.
Solution
Not sure what exactly is the problem but I would do it like this:
public void onCreate() {
super.onCreate();
loadViews(); //create instance of view objects textName, textDate, etc.
onSendData(null); //passing View as null
........
.....
}
Answered By - SafalFrom2050
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.