0
コンテンツにアクセスするためにユーザーが一連の「メニュー」をナビゲートするアプリケーションを作成しようとしています。
は私がアプリ問題EditTextユーザー入力に基づいて開いたアクティビティの設定
MainMenuActivity.java開いた時に表示されるメニュー作成:
public class MainMenuActivity extends AppCompatActivity {
ListView listView;
ArrayAdapter<String> main_adapter;
String[] main_menu = {
"1 INTRO",
"2 HELP",
"3 AROUND THE WORLD"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_menu_layout);
listView = (ListView) findViewById(R.id.main_list);
main_adapter = new ArrayAdapter<>(this, R.layout.main_list_custom_layout, R.id.main_list_item, main_menu);
listView.setAdapter(main_adapter);
}
public void openNewActivity(View view) {
EditText main_edit_text = (EditText) findViewById(R.id.main_edit_text);
String answer = main_edit_text.getText().toString().trim();
switch (answer) {
case "1": {
Intent intent = new Intent(this, IntroActivity.class);
startActivity(intent);
break;
}
case "2": {
Intent intent = new Intent(this, HelpActivity.class);
startActivity(intent);
break;
}
case "3": {
Intent intent = new Intent(this, AroundTheWorldActivity.class);
startActivity(intent);
break;
}
default: {
Intent intent = new Intent(getApplicationContext(), MainMenuActivity.class);
startActivity(intent);
break;
}
}
}
を、私は最初のメニューでのEditTextに入力すると表示されるメニュー「3」(ケース3)を作成しました。
AroundTheWorldActivity.java:
public class AroundTheWorldActivity extends Activity {
ListView listView;
ArrayAdapter<String> around_the_world_adapter;
String[] around_the_world_menu = {
"1 OVERVIEW",
"2 RECEIVING"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.around_the_world_layout);
listView = (ListView) findViewById(R.id.around_the_world_list);
around_the_world_adapter = new ArrayAdapter<>(this, R.layout.around_the_world_list_custom_layout, R.id.around_the_world_list_item, around_the_world_menu);
listView.setAdapter(around_the_world_adapter);
}
public void openNewActivity(View view) {
EditText around_the_world_edit_text = (EditText) findViewById(R.id.around_the_world_edit_text);
String answer = around_the_world_edit_text.getText().toString().trim();
switch (answer) {
case "1": {
Intent atwintent = new Intent(this, AroundTheWorldOverviewActivity.class);
startActivity(atwintent);
break;
}
case "2": {
Intent atwintent = new Intent(this, ReceivingActivity.class);
startActivity(atwintent);
break;
}
default: {
Intent atwintent = new Intent(getApplicationContext(), AroundTheWorldActivity.class);
startActivity(atwintent);
break;
}
}
}
Iは二次メニューの "1"(ケース1)を入力する際に開くアクティビティを構成しました。
AroundTheWorldOverviewActivity.java:
public class AroundTheWorldOverviewActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.around_the_world_overview_layout);
}
}
around_the_world_overview_layout.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
>
<TextView
android:id="@+id/atw_overview_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-smallcaps"
android:gravity="center_horizontal"
android:padding="16dp"
android:text="Around The World Overview Text"
android:textAppearance="?android:textAppearanceLarge"
android:textColor="#ffffff"
/>
</RelativeLayout>
私は2番目のメニューをナビゲートすることができていますが、私は第三のアクティビティにアクセスしようとすると、アプリが動作を停止/クラッシュ。
LogCat:
08-01 19:54:43.500 2220-2220/com.google.android.googlequicksearchbox:search
I/MicroDetectionWorker: Micro detection mode: [mDetectionMode: [1]].
08-01 19:54:43.502 2220-2220/com.google.android.googlequicksearchbox:search
I/AudioController: Using mInputStreamFactoryBuilder
08-01 19:54:43.534 2220-4313/com.google.android.googlequicksearchbox:search I/MicroRecognitionRunner: Starting detection.
08-01 19:54:43.540 2220-2324/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_starting [email protected]
08-01 19:54:43.548 1365-4316/? I/AudioFlinger: AudioFlinger's thread 0xacf83540 ready to run
08-01 19:54:43.562 2220-2324/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_started [email protected]
08-01 19:54:43.567 2220-2324/com.google.android.googlequicksearchbox:search E/ActivityThread: Failed to find provider info for com.google.android.apps.gsa.testing.ui.audio.recorded
08-01 19:54:43.569 2220-2324/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_close [email protected]
08-01 19:54:43.573 2220-2220/com.google.android.googlequicksearchbox:search I/MicroDetectionWorker: onReady
08-01 19:54:43.588 2220-4313/com.google.android.googlequicksearchbox:search I/MicroRecognitionRunner: Detection finished
08-01 19:54:43.588 2220-4313/com.google.android.googlequicksearchbox:search W/ErrorReporter: reportError [type: 211, code: 524300]: Error reading from input stream
08-01 19:54:43.590 2220-2492/com.google.android.googlequicksearchbox:search I/MicroRecognitionRunner: Stopping hotword detection.
08-01 19:54:43.591 2220-4313/com.google.android.googlequicksearchbox:search W/ErrorProcessor: onFatalError, processing error from engine(4)
com.google.android.apps.gsa.shared.speech.a.g: Error reading from input stream
at com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(SourceFile:342)
at com.google.android.apps.gsa.staticplugins.recognizer.i.a$1.run(SourceFile:1367)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
at com.google.android.apps.gsa.speech.audio.Tee.g(SourceFile:2531)
at com.google.android.apps.gsa.speech.audio.ap.read(SourceFile:555)
at java.io.InputStream.read(InputStream.java:101)
at com.google.android.apps.gsa.speech.audio.al.run(SourceFile:362)
at com.google.android.apps.gsa.speech.audio.ak$1.run(SourceFile:471)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
08-01 19:54:43.591 2220-4313/com.google.android.googlequicksearchbox:search I/AudioController: internalShutdown
08-01 19:54:43.601 2220-2220/com.google.android.googlequicksearchbox:search I/MicroDetector: Keeping mic open: false
08-01 19:54:43.601 2220-2220/com.google.android.googlequicksearchbox:search I/MicroDetectionWorker: #onError(false)
08-01 19:54:43.603 2220-4312/com.google.android.googlequicksearchbox:search I/DeviceStateChecker: DeviceStateChecker cancelled
08-01 19:54:43.625 2220-2234/com.google.android.googlequicksearchbox:search I/art: Background sticky concurrent mark sweep GC freed 8140(454KB) AllocSpace objects, 7(2MB) LOS objects, 15% free, 14MB/17MB, paused 7.682ms total 89.059ms
08-01 19:54:45.634 1900-2821/com.android.phone I/OmtpVvmCarrierCfgHlpr: OmtpEvent:CONFIG_STATUS_SMS_TIME_OUT
08-01 19:54:45.641 1900-1900/com.android.phone I/RetryPolicy: discarding deferred status: configuration_state=4
08-01 19:54:45.655 1900-1900/com.android.phone D/VvmTaskScheduler: No more tasks, stopping service if no task are added in 5000 millis
08-01 19:54:45.661 1900-1900/com.android.phone D/VvmTaskScheduler: create task:com.android.phone.vvm.omtp.ActivationTask
08-01 19:54:45.662 1900-1900/com.android.phone D/RetryPolicy: retry #2 for [email protected] queued, executing in 5000
08-01 19:54:45.669 1900-1900/com.android.phone D/VvmTaskScheduler: minimal wait time:4995
08-01 19:54:45.671 1900-1900/com.android.phone D/VvmTaskScheduler: minimal wait time:4993
あなたがクラッシュログを投稿した場合、多分私たちはあなたを助けることができます –
それはすばらしいでしょう。申し訳ありませんが、私はAndroid Studioには比較的新しいので、クラッシュログの検索方法がわかりません。私はそれを何度かGoogleで探そうとしていますが、私は一般的にアンドロイドデバイスに精通していないので、私はまだかなり混乱しています。クラッシュログはどこで見つけることができますか? –
IDEの下に「Android Monitor」というタブがあります。あなたのアプリを実行する、クラッシュログはそこに利用可能です。 –