2015-01-04 3 views
0

안녕하십니까. 로그인에 성공하면 새로운 활동 nextactivity.xml을 시작합니다.이 활동을 시작하면 성공적으로 시작될 수 없습니다. 로그인 활동은 다음과 같습니다. 여전히 거기에 있습니다. 뒤로 버튼을 누르면 nextactivity.xml이 시작됩니다. nextactivity.xml에 대한 코드는 다음과 같습니다내비게이션 서랍이 포함 된 활동을 시작하는 방법

<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@android:color/white"> 

<!-- Framelayout to display Fragments --> 
<FrameLayout 
    android:id="@+id/frame_container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

<!-- Listview to display slider menu --> 
<ListView 
    android:id="@+id/list_slidermenu" 
    android:layout_width="240dp" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:choiceMode="singleChoice" 
    android:divider="@color/list_divider" 
    android:dividerHeight="1dp"   
    android:listSelector="@drawable/list_selector" 
    android:background="@color/list_background" 
    /> 
</android.support.v4.widget.DrawerLayout> 

나는이 함께 nextactivity.xml 시작하고있다 : 당신이 로그인 버튼 클릭 다른 활동을 시작하는 데 사용하는

 loginButton.setOnClickListener(new OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      // TODO Auto-generated method stub 
      if(userid.getText().toString().isEmpty() &&password.getText().toString().isEmpty()){ 
       Toast.makeText(getApplicationContext(), "Login Successfull",Toast.LENGTH_LONG).show(); 
       Intent mainActivityIntent=new Intent(LoginActivity.this,NextActivity.class); 
       LoginActivity.this.startActivity(mainActivityIntent); 
       finish(); 
       onBackPressed(); 

      } 
+1

왜 finish를 호출 한 후에 onBackPressed()를 호출합니까 ?? 그 구현은 무엇입니까? –

답변

0

코드 올바른 찾고 있습니다. 다른 활동이 로그인 활동을 다시 시작하는지 확인해야합니다.

관련 문제