私の "sodrzina" を他の xml レイアウトで表示する方法.. setContentView(R.layout.sodrzina); ..これらの方法では、クリックすると他のレイアウトが開きますが、コンテンツはありません。そこに私のコンテンツを表示する方法は?
View.OnClickListener
getOnClickDoSomething(final Button button) {
return new View.OnClickListener() {
public void onClick (View v){
//TextView View = (TextView) findViewById(R.id.viewSodrzina);
setContentView(R.layout.sodrzina);
TextView View = (TextView) findViewById(R.id.viewSodrzina);
String sodrzina="";
}
}
String sodrzina="";
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.cook-recipes.hostoi.com/jsonscript/sodrzina.php?sodrzina="+(button.getText()).toString().replace(" ","%20"));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream webs = entity.getContent();
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(webs,"iso-8859-1"),8);
//myListView.setText(reader.readLine());
int askiChar=0;
while((askiChar =reader.read())!=-1)
{
sodrzina+= ((char)askiChar);
}
webs.close();
reader.close();
}catch(Exception e){
Log.e("log_tag","Error converting reslt"+e.toString());
}
//TextView prikaziSodrzina = (TextView)findViewById(R.id.viewSodrzina);
//Toast.makeText(Desert.this,sodrzina, Toast.LENGTH_LONG).show();
//prikaziSodrzina.append(sodrzina);
// View.append(sodrzina);
}
catch (Exception e)
{
Log.e("ERROR","ERROR IN CODE: "+e.toString());
e.printStackTrace();
}
}