Click here to Skip to main content
15,885,910 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi.. I'm a baginer developer in android..
my first app is so simple, i am using plugin roboguice 1.1 and now i want to make app using slidingmenu.
I was create slidingmenu like http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer and it's running succesful.
but if I want use login activity to access slidingmenu, I goting error in "setContentView(R.layout.activity_login);"

this is my LoginActivity.java
Java
package com.example.app.Screen;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.app.R;
import com.example.app.guice.Application;
import roboguice.activity.RoboActivity;


/**
 * Created with IntelliJ IDEA.
 * User: aby
 * Date: 6/7/14
 * Time: 4:25 AM
 * To change this template use File | Settings | File Templates.
 */
public class LoginActivity extends RoboActivity {
    Application app;
    private TextView useridView;
    private TextView passView;
    private Button loginBtn;
    private String buttonLabel;
    private ImageView loading;
    private boolean closeApp=true;


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        app = (Application) getApplication();
        useridView = (TextView) findViewById(R.id.useridEdTxt);
        passView = (TextView) findViewById(R.id.passEdTxt);
        loginBtn = (Button) findViewById(R.id.userLoginBtn);
        loading = (ImageView) findViewById(R.id.login_loading);
    }

    @Override
         protected void onPause() {
        super.onPause();
        finish();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (closeApp)
        app.stopServices();
    }

    public void doLogin(View view){
//        hideKeyboard(view);
        if (!app.isNetworkAvailable()){
            Toast.makeText(this, "Tidak terhubung ke internet. Pastikan koneksi data telah tersambung.", Toast.LENGTH_LONG).show();
            return;
        }
        if (useridView.getText().equals("") || passView.getText().equals("")){
            Toast.makeText(this, "Silakan isi dengan data yang benar", Toast.LENGTH_LONG).show();
            return;
        }

        loginBtn.setEnabled(false);
        buttonLabel = String.valueOf(loginBtn.getText());
        startLoading();
//        ... ... ...
    }

    private void startLoading() {
        loading.setVisibility(View.VISIBLE);
        ((AnimationDrawable)loading.getBackground()).start();
    }

    private void stopLoading() {
        loading.setVisibility(View.INVISIBLE);
        ((AnimationDrawable)loading.getBackground()).stop();
    }

}


and This is my activity_login.xml

XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">
    <View
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:removed="@drawable/background"
            android:/>
    <LinearLayout
            android:id="@+id/userLoginLayout"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:>
        <TextView
                android:text="@string/userid"
                android:textColor="@color/blue_dark"
                android:textSize="15sp"
                android:textStyle="bold"
                android:layout_width="fill_parent"
                android:layout_marginLeft="16dp"
                android:layout_height="wrap_content"/>
        <EditText
                android:id="@+id/useridEdTxt"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:singleLine="true"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"/>
        <TextView
                android:text="@string/password"
                android:textColor="@color/blue_dark"
                android:textSize="15sp"
                android:textStyle="bold"
                android:layout_width="fill_parent"
                android:layout_marginLeft="16dp"
                android:layout_height="wrap_content"/>
        <EditText
                android:id="@+id/passEdTxt"
                android:inputType="textPassword"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="8dp"
                android:singleLine="true"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"/>
        <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp">
            <ImageView
                    android:id="@+id/login_loading"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="3dp"
                    android:layout_marginRight="3dp"
                    android:layout_alignParentRight="true"
                    android:visibility="invisible"
                    android:background="@drawable/spin_loading"/>
            <Button
                    android:id="@+id/userLoginBtn"
                    android:text="Login"
                    android:/>
        </RelativeLayout>
    </LinearLayout>
    <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true">
        <ImageView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:scaleType="fitXY"
                android:src="@drawable/footer"/>
    </LinearLayout>
</RelativeLayout>


please help me, why i getting error like that
Posted
Comments
Richard MacCutchan 23-Feb-15 8:55am    
You need to tell us what the error is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900