I have an Android widget that displays a TextView in a FrameLayout . TextView fills the entire parent layout. What I want to do, it will be able to change at runtime, where the text appears in the TextView .
I would currently do this by changing the gravity in the TextView ... It even has a setGravity(int) method that should work fine with RemoteView (I'm in the widget, remember?). In theory, anyway.
Unfortunately, this happens with an error. Something about "can't run setGravity(int) here" or sth. Will be updated with an accurate error message if necessary
I am using this snippet:
myRemoteView.setInt(R.id.myTextView, "setGravity", myGravity);
Has anyone tried this before and have any ideas?
source share