テキスト ビューの .setText 関数が原因で、アプリケーションがクラッシュします。私が読んだことから、問題はUIスレッドにないことに関する何かである可能性がありますが、それを修正する方法がわかりません
public class SingleMenuItemActivity extends Activity {
TextView lblName;
TextView lblyest;
TextView lbltoday;
TextView lblHigh;
TextView lblLow;
TextView lblChange;
TextView lblPcchange;
Button set;
String name, yesterday, today, high, low, change, pcchange;
@Override
protected void onCreate (Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate( savedInstanceState );
setContentView( R.layout.single_list_item);
set=(Button) findViewById(R.id.btnSet);
lblName = (TextView) findViewById( R.id.name );
lblyest = (TextView) findViewById( R.id.yesterday );
lbltoday = (TextView) findViewById( R.id.today );
lblHigh = (TextView) findViewById( R.id.high );
lblLow = (TextView) findViewById( R.id.low );
lblChange = (TextView) findViewById( R.id.change );
lblPcchange = (TextView) findViewById( R.id.pcchange );
Intent in = getIntent();
name = in.getStringExtra( "name" );
;
yesterday = in.getStringExtra( "yesterday" );
today = in.getStringExtra( "today" );
high = in.getStringExtra( "high" );
low = in.getStringExtra( "low" );
change = in.getStringExtra( "change" );
pcchange = in.getStringExtra( "pcchange" );
lblName.setText(name);
lblyest.setText(yesterday);
lbltoday.setText(today);
lblHigh.setText(high);
lblLow.setText(low);
lblChange.setText(change);
lblPcchange.setText(pcchange);
}
}
問題が何であるかを正確に理解できない
logcatは次のとおりです。
10-10 15:37:14.544: I/ActivityManager(58): Starting activity: Intent { cmp=com.kmarima.knight/.SingleMenuItemActivity (has extras) }
10-10 15:37:18.217: D/SntpClient(58): request time failed: java.net.SocketException: Address family not supported by protocol
10-10 15:37:24.613: W/ActivityManager(58): Launch timeout has expired, giving up wake lock!
10-10 15:37:24.685: W/ActivityManager(58): Activity idle timeout for HistoryRecord{45018590 com.kmarima.knight/.SingleMenuItemActivity}
10-10 15:37:29.874: D/dalvikvm(264): GC_EXPLICIT freed 2061 objects / 147656 bytes in 165ms
10-10 15:37:34.914: D/dalvikvm(296): GC_EXPLICIT freed 811 objects / 56944 bytes in 162ms
そしてここから活動開始
Intent in = new Intent(KnightActivity.this, SingleMenuItemActivity.class);
in.putExtra("name", "The Name");
in.putExtra("yesterday", "Value For Yesterday");
in.putExtra("today", "Todays Value");
in.putExtra("high", "High Value");
in.putExtra("low", "Low Value");
in.putExtra("change", "Change Value");
in.putExtra("pcchange", "PC Change Value");
startActivity(in);