Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid listactivity not working
    primarykey
    data
    text
    <p>i am learning android from <a href="https://www.youtube.com/watch?v=roulejuE6B8" rel="nofollow">newboston</a> .. i want to show a menu first as showing in this tutorial .. i have done all the same but dont know why menu activity is not coming up .. help me where i am doing wrong</p> <p>this is my code </p> <p>android manfiest.xml</p> <pre><code>&lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".Splash" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;!-- 2nd activity --&gt; &lt;activity android:name="com.example.android.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="com.example.android.MainActivity" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;!-- 3rd Activity Test --&gt; &lt;activity android:name=".Menu" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="com.example.android.Menu" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".TesxtPlay" android:label="@string/app_name" &gt; &lt;/activity&gt; &lt;/application&gt; </code></pre> <p></p> <p>this is the menuClass</p> <pre><code> public class Menu extends ListActivity { //declaring above so both methods can access these String classes[] = {"MainActivity","TextPlay","example2", "example3","example4","example5","example6",}; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter&lt;String&gt;(Menu.this, android.R.layout.simple_list_item_1, classes)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub super.onListItemClick(l, v, position, id); String cheese = classes[position]; Class ourClass; try { ourClass = Class.forName("com.example.android." + cheese); Intent ourIntent = new Intent(Menu.this,ourClass); startActivity(ourIntent); }catch(ClassNotFoundException e){ e.printStackTrace(); } } } </code></pre> <p>textPlayclass</p> <pre><code> public class TextPlay extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.test); Button chkCmd = (Button) findViewById(R.id.bResults); final ToggleButton passTog = (ToggleButton) findViewById(R.id.tbPassword); final EditText input = (EditText) findViewById(R.id.etCommands); TextView display = (TextView) findViewById(R.id.display); passTog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub if(passTog.isChecked()){ input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); }else{ input.setInputType(InputType.TYPE_CLASS_TEXT); } } }); } } </code></pre> <p>splash</p> <pre><code> public class Splash extends Activity { MediaPlayer ourSong; @Override protected void onCreate(Bundle iloveyou) { // TODO Auto-generated method stub super.onCreate(iloveyou); setContentView(R.layout.splash); ourSong = new MediaPlayer().create(Splash.this, R.raw.kalimba); ourSong.start(); Thread timer = new Thread(){ public void run(){ try{ sleep(5000); }catch(InterruptedException e){ e.printStackTrace(); }finally{ //starting activity Intent openMainActivityClass = new Intent("com.example.android.MainActivity"); startActivity(openMainActivityClass); } } }; timer.start(); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); ourSong.release(); finish(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload