Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 1.89 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Getting ActivityNotFoundException even though it should exist
  2. <uses-sdk android:minSdkVersion="7" />
  3.  
  4. <application
  5.     android:icon="@drawable/ic_launcher"
  6.     android:label="@string/app_name" >
  7.     <activity
  8.         android:name=".ListsActivity"
  9.         android:label="@string/app_name"
  10.         android:theme="@android:style/Theme.NoTitleBar">
  11.         <intent-filter>
  12.             <action android:name="android.intent.action.MAIN" />
  13.  
  14.             <category android:name="android.intent.category.LAUNCHER" />
  15.         </intent-filter>
  16.     </activity>
  17.  
  18.     <activity android:name=".ListActivity" ></activity>
  19. </application>
  20.        
  21. package org.softnux.android.lists;
  22.  
  23. import android.app.Activity;
  24. import android.app.ListActivity;
  25. import android.content.Intent;
  26. import android.os.Bundle;
  27. import android.view.View;
  28. import android.widget.Button;
  29.  
  30.  
  31. public class ListsActivity extends Activity
  32. {
  33.     @Override
  34.     public void onCreate(Bundle savedInstanceState)
  35.     {
  36.         super.onCreate(savedInstanceState);
  37.         setContentView(R.layout.lists);
  38.  
  39.         Button intentTestButton = (Button) findViewById(R.id.intentTestButton);
  40.  
  41.         intentTestButton.setOnClickListener(new Button.OnClickListener()
  42.         {
  43.  
  44.             public void onClick(View v)
  45.             {
  46.                 Intent showListViewIntent = new Intent(ListsActivity.this,
  47.                         ListActivity.class);
  48.                 startActivity(showListViewIntent);
  49.             }
  50.  
  51.         });
  52.     }
  53. }
  54.        
  55. package org.softnux.android.lists;
  56.  
  57. import android.app.Activity;
  58. import android.os.Bundle;
  59.  
  60. public class ListActivity extends Activity
  61. {
  62.     @Override
  63.     public void onCreate(Bundle savedInstanceState)
  64.     {
  65.         super.onCreate(savedInstanceState);
  66.         setContentView(R.layout.list);
  67.     }
  68.  
  69. }
  70.        
  71. Intent showListViewIntent = new Intent(ListsActivity.this, ListActivity.class);
  72. startActivity(showListViewIntent);
  73.        
  74. import android.app.ListActivity;