2011-08-05 42 views
0

我有這樣的代碼:在活動更改中獲取錯誤?

if (!errors.isEmpty()) { 
     Context context = getApplicationContext(); 
     int duration = Toast.LENGTH_LONG; 
     Toast toast = Toast.makeText(context, errors, duration); 
     toast.show(); 
    } else { 
     // Success! Cache the inputs and continue with registration. 
     SharedPreferences settings = getSharedPreferences("settings", 0); 
     SharedPreferences.Editor editor = settings.edit(); 
     editor.putString("name", name); 
     editor.putString("email", email); 
     editor.putString("password", password); 

     Intent i = new Intent(view.getContext(), 
       sendRegisterActivity.class); 
     startActivityForResult(i, 0); 
    } 

現在,這是它的一個按鈕的點擊開了public void sendRegistration(View view)內。每當我拿走它的「else」語句的最後3行時。但是當我添加它時,我會得到「無法找到源」。 sendRegisterActivity.java存在,但仍然出現錯誤。這是sendRegisterActivity的樣子:

public class sendRegisterActivity extends Activity { 
/** Called when the activity is first created. */ 
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.sendregister); 
    } 
} 

sendregister.xml是「佈局」文件夾中,並且是完全有效的。

回答

3

您是否已將sendRegisterActivity添加到清單中?

+1

我錯過了!我爲了我的最後一次行動做了這件事,但這次忘記了這一步。謝謝,我感到非常愚蠢:P – Qasim

+1

哈,我這樣做是因爲 –