(Edited) I am completely new to android app development. My question is: How can I rename a java class with two words instead of one?
My main menu consists of 3 options, each linked to a java class:
public class Menu extends ListActivity{
String classes[] = { "Report","Study","Contact",};
To change the names displayed on my main menu, I need to modify the corresponding java class name. For example, I want the first option to be displayed as [Report Odor] instead of just [Report].
I attempted the following approach: I right-clicked on the class and chose "Refactor->Rename". However, this method throws an error if I try to add a space between the two words.
Am I proceeding correctly with this task? Any assistance would be greatly appreciated. Regards. Here is the complete code for my main menu: package com.reportodor.mohamed;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Menu extends ListActivity{
String displayNames[] = { "Report Odor","Study","Contact",};
Class activities[] = {Report.class, Study.class, Contact.class};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(Menu.this, android.R.layout.simple_list_item_1, displayNames));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String selection = displayNames[position];
try{
Class ourClass = Class.forName("com.reportodor.mohamed." + selection);
Intent intent = new Intent(Menu.this, ourClass);
startActivity(intent);
}catch (ClassNotFoundException e){
e.printStackTrace();
}
}