in my AsyncTask in the
@Override
protected void onProgressUpdate(Void... values)
method, which runs on the UI-Thread i try to set Text of my MainLayout to "":
LayoutInflater temporaryInflater = (LayoutInflater) myActivityContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View temporaryRootView = temporaryInflater.inflate(R.layout.myLayout, (ViewGroup) gv.getParent(), false);
EditText temporaryEditText = (EditText) temporaryRootView.findViewById(R.id.myEdtiText);
temporaryEditText.setText("");
This should work fine, i try to Change a view on the UIThread i provide a correct RootView with a rootViewGroup parent to provide LayoutParams but nothing happens. EditText stays with the old Text.
Any suggestions? Would appreciate that.
Update regarding Rohan550's comments/hint:
I will try your solution but isn't that the same(just for understanding):
public void resetEditText() {
EditText temporaryEditText = (EditText) MyActivity.this.findViewById(R.id.myEditText);
temporaryEditText.setText("");
}
which is in the Activity and in the AsyncTask on the UIThread in onProgressUpdate i call:
MyActivity wusch = new MyActivity();
wusch.resetEditText();
But it throws a NPE at findViewById
in the resetEditText
method..
Why?