2-textview と 1 つのボタンを使用して、最初のテキスト ビューに記述した特定の Web サイトのテキスト コンテンツを取得し、2 番目のテキスト ビューにテキスト コンテンツを配置するプログラムを作成します。
しかし、それは機能しません。失敗はコードのこの部分にある可能性があります-私はすべてのものをチェックしました、それは単独でうまく機能します-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final EditText Enter = (EditText) findViewById(R.id.Enter);
CharSequence web = Enter.getText();
// CharSequence web = "http://www.google.com" ;
final String link = web.toString() ;
Button Press = (Button)findViewById(R.id.Press);
Press.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v ) {
Toast.makeText(MainActivity.this, link ,Toast.LENGTH_LONG ).show();
new DownloadTextTask().execute(
link);
}
});
}