How to open a new intent when there are spaces within the array (such as "Hello World") The class I'm trying to access is called startingPoint.
It gives me an error as there cannot be any spaces within the -> android:name=""
Is there any workaround?
Thanks in advance
Root.java
public class Root extends ListActivity {
String classes[] = { "Hello World", "Another Item", "Email"};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(Root.this,
R.layout.root, 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 MENU_CHOICE = classes[position];
try {
Class ourClass = Class.forName("se.hello.visboken." + MENU_CHOICE);
Intent ourIntent = new Intent(Root.this, ourClass);
startActivity(ourIntent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
My manifest looks like this
<activity
android:name=".Splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Root"
android:label="@string/app_name">
<intent-filter>
<action android:name="se.hello.visboken.ROOT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".startingPoint"
android:label="Hello World" >
<intent-filter>
<action android:name="se.hello.visboken.startingPoint" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>