java - Trouble Configuring Activities that are Opened based on EditText User Input -
i attempting create app in user navigates through series of "menus" in order access content.
created menu appears upon opening app
mainmenuactivity.java:
public class mainmenuactivity extends appcompatactivity { listview listview; arrayadapter<string> main_adapter; string[] main_menu = { "1 intro", "2 help", "3 around 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; } } }
and created menu appears upon typing "3" (case 3) edittext on first menu.
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 configured activity opens upon inputting "1" (case 1) in secondary menu.
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 world overview text" android:textappearance="?android:textappearancelarge" android:textcolor="#ffffff" /> </relativelayout>
i able navigate through second menu, when attempt access third activity, app stops working/crashes.
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 com.google.android.apps.gsa.staticplugins.z.c@ae6a309 08-01 19:54:43.548 1365-4316/? i/audioflinger: audioflinger's thread 0xacf83540 ready run 08-01 19:54:43.562 2220-2324/com.google.android.googlequicksearchbox:search i/microphoneinputstream: mic_started com.google.android.apps.gsa.staticplugins.z.c@ae6a309 08-01 19:54:43.567 2220-2324/com.google.android.googlequicksearchbox:search e/activitythread: failed find provider info 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 com.google.android.apps.gsa.staticplugins.z.c@ae6a309 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 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 engine(4) com.google.android.apps.gsa.shared.speech.a.g: error reading input stream @ com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(sourcefile:342) @ com.google.android.apps.gsa.staticplugins.recognizer.i.a$1.run(sourcefile:1367) @ java.util.concurrent.executors$runnableadapter.call(executors.java:428) @ java.util.concurrent.futuretask.run(futuretask.java:237) @ com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(sourcefile:66) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1133) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:607) @ java.lang.thread.run(thread.java:761) @ 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. @ com.google.android.apps.gsa.speech.audio.tee.g(sourcefile:2531) @ com.google.android.apps.gsa.speech.audio.ap.read(sourcefile:555) @ java.io.inputstream.read(inputstream.java:101) @ com.google.android.apps.gsa.speech.audio.al.run(sourcefile:362) @ com.google.android.apps.gsa.speech.audio.ak$1.run(sourcefile:471) @ java.util.concurrent.executors$runnableadapter.call(executors.java:428) @ java.util.concurrent.futuretask.run(futuretask.java:237) @ com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(sourcefile:66) @ com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(sourcefile:139) @ com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(sourcefile:139) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1133) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:607) @ java.lang.thread.run(thread.java:761) @ 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 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 com.android.phone.vvm.omtp.activationtask@6bd2e67 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
oops... forgot add activity manifest file- appreciate everyone's help, , hope didn't take of anyone's time!
Comments
Post a Comment