每当从活动类中删除textview
项时,在更新活动类中的recyclerview
时都会遇到问题。 getActivity()
在这里不可用。谢谢大家。
public class ViewHolder extends RecyclerView.ViewHolder {
ImageView delete_from_cart;
public ViewHolder(final View itemView) {
super(itemView);
delete_from_cart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// here I want to change the textview
DatabaseHelper dh = new DatabaseHelper(context);
dh.deleteCartDetail(product_name.getText().toString());
delete(getLayoutPosition());
}
});
}
}
答案 0 :(得分:1)
可以有不同的方法来实现。下面是一些。
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
mathcaptha = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "captchaOperation"))).text.replace(" =", "")
print(eval(mathcaptha))
类中传递活动参考,并调用活动方法以更新textview。像Adapter
; 答案 1 :(得分:0)
from pandas_datareader import data as pdr
import fix_yahoo_finance as yf
data = yf.download("MSFT", start="2017-01-01", end="2017-04-30")
print(data)
[*********************100%***********************] 1 of 1 downloaded
Open High ... Adj Close Volume
Date ...
2017-01-03 62.790001 62.840000 ... 60.664047 20694100
2017-01-04 62.480000 62.750000 ... 60.392612 21340000
2017-01-05 62.189999 62.660000 ... 60.392612 24876000
2017-01-06 62.299999 63.150002 ... 60.916084 19922900
2017-01-09 62.759998 63.080002 ... 60.722206 20256600
2017-01-10 62.730000 63.070000 ... 60.702820 18593000