私はAndroid携帯用の新しい種類のアプリを開発しています。Spinnerウィジェットに問題があります。クラスとVarsが原因だと思いますが、実際の問題が何であるかはわかりません...これはコードです。
public class BHac extends Activity
{
String[] tzIDs = new String[10000];
String sText;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.bhac);
try
{
tzIDs = TimeZone.getAvailableIDs();
Spinner spinner = (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, tzIDs);
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setSelection(1);
spinner.setAdapter(spinnerArrayAdapter);
try
{
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id)
{
sText= tzIDs[pos];
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
String timestamp = formatter.format(TimeZone.getTimeZone(sText));
TextView t = (TextView)findViewById(R.id.textView2);
t.setText(timestamp);
}
public void onNothingSelected(AdapterView<?> parent)
{
}
});
}
catch (Exception x)
{
Context context = getApplicationContext();
CharSequence text = "Android Exception [BHAC]" + x;
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
Log.e ("WHWJDAKDJKAJKLDJSKKKKKK", "dadada" + x);
}
これはLogCatです:
05-06 19:53:50.950: E/global(334): Deprecated Thread methods are not supported.
05-06 19:53:50.950: E/global(334): java.lang.UnsupportedOperationException
05-06 19:53:50.950: E/global(334): at java.lang.VMThread.stop(VMThread.java:85)
05-06 19:53:50.950: E/global(334): at java.lang.Thread.stop(Thread.java:1280)
05-06 19:53:50.950: E/global(334): at java.lang.Thread.stop(Thread.java:1247)
05-06 19:53:50.950: E/global(334): at smale.app.dc.SmaleActivity$1.run(SmaleActivity.java:58)
05-06 19:53:51.748: D/dalvikvm(334): GC_EXTERNAL_ALLOC freed 62K, 53% free 2569K/5379K, external 2034K/2137K, paused 98ms
05-06 19:56:36.559: D/AndroidRuntime(334): Shutting down VM
05-06 19:56:36.559: W/dalvikvm(334): threadid=1: thread exiting with uncaught exception (group=0x40015560)
05-06 19:56:36.659: E/AndroidRuntime(334): FATAL EXCEPTION: main
05-06 19:56:36.659: E/AndroidRuntime(334): java.lang.IllegalArgumentException
05-06 19:56:36.659: E/AndroidRuntime(334): at java.text.DateFormat.format(DateFormat.java:365)
05-06 19:56:36.659: E/AndroidRuntime(334): at java.text.Format.format(Format.java:93)
05-06 19:56:36.659: E/AndroidRuntime(334): at smale.app.dc.BHac$1.onItemSelected(BHac.java:62)
05-06 19:56:36.659: E/AndroidRuntime(334): at android.widget.AdapterView.fireOnSelected(AdapterView.java:871)
05-06 19:56:36.659: E/AndroidRuntime(334): at android.widget.AdapterView.access$200(AdapterView.java:42)
05-06 19:56:36.659: E/AndroidRuntime(334): at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:837)
05-06 19:56:36.659: E/AndroidRuntime(334): at android.os.Handler.handleCallback(Handler.java:587)
05-06 19:56:36.659: E/AndroidRuntime(334): at android.os.Handler.dispatchMessage(Handler.java:92)
05-06 19:56:36.659: E/AndroidRuntime(334): at android.os.Looper.loop(Looper.java:123)
05-06 19:56:36.659: E/AndroidRuntime(334): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-06 19:56:36.659: E/AndroidRuntime(334): at java.lang.reflect.Method.invokeNative(Native Method)
05-06 19:56:36.659: E/AndroidRuntime(334): at java.lang.reflect.Method.invoke(Method.java:507)
05-06 19:56:36.659: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-06 19:56:36.659: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-06 19:56:36.659: E/AndroidRuntime(334): at dalvik.system.NativeStart.main(Native Method)
誰かがアイデアを持っていますか?