TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
SOFARI HASSANE
NA
237
21.5k
App has stopped
Mar 29 2018 9:31 AM
Hi!
I'm looking for help with this error!
activity.xml
android.support.design.widget.CoordinatorLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
xmlns:app
=
"http://schemas.android.com/apk/res-auto"
xmlns:tools
=
"http://schemas.android.com/tools"
android:layout_width
=
"match_parent"
android:layout_height
=
"match_parent"
tools:context
=
"com.example.di_prn.ganigazapp.ArticlesDetails"
>
<
android.support.design.widget.AppBarLayout
android:id
=
"@+id/app_bar_layout"
android:layout_width
=
"match_parent"
android:layout_height
=
"wrap_content"
android:theme
=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows
=
"true"
>
<
android.support.design.widget.CollapsingToolbarLayout
android:id
=
"@+id/collapsing"
android:layout_width
=
"match_parent"
android:layout_height
=
"350dp"
android:fitsSystemWindows
=
"true"
app:layout_scrollFlags
=
"scroll|exitUntilCollapsed"
app:contentScrim
=
"#0e0d0e"
app:expandedTitleTextAppearance
=
"@android:color/transparent"
>
<
ImageView
android:id
=
"@+id/img_article"
android:layout_width
=
"match_parent"
android:layout_height
=
"match_parent"
android:contentDescription
=
"@null"
android:scaleType
=
"centerCrop"
app:layout_collapseMode
=
"parallax"
/>
<
android.support.v7.widget.Toolbar
android:id
=
"@+id/toolbar"
android:layout_width
=
"match_parent"
android:layout_height
=
"?attr/actionBarSize"
app:popupTheme
=
"@style/AlertDialog.AppCompat.Light"
app:layout_collapseMode
=
"parallax"
/>
</
android.support.design.widget.CollapsingToolbarLayout
>
</
android.support.design.widget.AppBarLayout
>
<
android.support.design.widget.FloatingActionButton
android:id
=
"@+id/btnCart"
android:src
=
"@drawable/ic_shopping_cart_black_24dp"
app:backgroundTint
=
"@android:color/white"
android:layout_width
=
"match_parent"
android:layout_height
=
"wrap_content"
android:elevation
=
"6dp"
app:pressedTranslationZ
=
"12dp"
app:layout_anchor
=
"@id/app_bar_layout"
app:layout_anchorGravity
=
"bottom|right|end"
app:useCompatPadding
=
"true"
/>
<
android.support.v4.widget.NestedScrollView
android:id
=
"@+id/nestedScrollView"
android:clipToPadding
=
"false"
android:layout_width
=
"match_parent"
android:layout_height
=
"match_parent"
app:layout_behavior
=
"@string/appbar_scrolling_view_behavior"
>
<
LinearLayout
android:orientation
=
"vertical"
android:layout_width
=
"match_parent"
android:layout_height
=
"match_parent"
>
<
android.support.v7.widget.CardView
android:layout_width
=
"match_parent"
android:layout_height
=
"wrap_content"
app:cardElevation
=
"5dp"
app:cardUseCompatPadding
=
"true"
>
<
LinearLayout
android:orientation
=
"vertical"
android:layout_width
=
"match_parent"
android:layout_height
=
"wrap_content"
>
<
TextView
android:id
=
"@+id/article_name"
android:layout_marginTop
=
"8dp"
android:padding
=
"12dp"
android:text
=
"Nom de l'Article"
android:textColor
=
"@color/colorPrimary"
android:textSize
=
"20sp"
android:textStyle
=
"bold"
android:layout_width
=
"wrap_content"
android:layout_height
=
"wrap_content"
/>
<
LinearLayout
android:id
=
"@+id/layout_price"
android:orientation
=
"horizontal"
android:layout_width
=
"match_parent"
android:layout_height
=
"wrap_content"
>
<
ImageView
android:src
=
"@drawable/ic_money"
android:layout_weight
=
"1"
android:layout_width
=
"0dp"
android:layout_height
=
"wrap_content"
/>
<
TextView
android:id
=
"@+id/article_price"
android:text
=
"1,000"
android:textColor
=
"@color/colorPrimary"
android:textSize
=
"18sp"
android:textStyle
=
"bold"
android:layout_width
=
"0dp"
android:layout_weight
=
"9"
android:layout_height
=
"wrap_content"
/>
</
LinearLayout
>
<
com.cepheuen.elegantnumberbutton.view.ElegantNumberButton
android:layout_width
=
"100dp"
android:layout_height
=
"30dp"
android:id
=
"@+id/number_button"
android:layout_marginTop
=
"8dp"
android:layout_marginLeft
=
"8dp"
android:layout_marginBottom
=
"18dp"
app:textSize
=
"8sp"
app:backGroundColor
=
"@color/colorPrimary"
app:initialNumber
=
"1"
app:finalNumber
=
"10"
/>
</
LinearLayout
>
</
android.support.v7.widget.CardView
>
<
android.support.v7.widget.CardView
app:cardElevation
=
"5dp"
app:cardUseCompatPadding
=
"true"
android:layout_width
=
"match_parent"
android:layout_height
=
"wrap_content"
>
<
TextView
android:id
=
"@+id/article_description"
android:layout_marginTop
=
"12dp"
android:lineSpacingMultiplier
=
"1.5"
android:padding
=
"12dp"
android:text
=
"Détails Article"
android:textColor
=
"@android:color/black"
android:textSize
=
"14sp"
android:layout_width
=
"wrap_content"
android:layout_height
=
"wrap_content"
/>
</
android.support.v7.widget.CardView
>
</
LinearLayout
>
</
android.support.v4.widget.NestedScrollView
>
</
android.support.design.widget.CoordinatorLayout
>
Home.java
public
class
Home
extends
AppCompatActivity
implements
NavigationView.OnNavigationItemSelectedListener {
FirebaseDatabase database;
DatabaseReference category;
TextView txtFullName;
RecyclerView recycler_menu;
RecyclerView.LayoutManager layoutManager;
FirebaseRecyclerAdapter<Category,MenuViewHolder> adapter;
@Override
protected
void
onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_home);
super
.onCreate(savedInstanceState);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(
"Menu"
);
setSupportActionBar(toolbar);
database = FirebaseDatabase.getInstance();
category = database.getReference(
"Category"
);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(
new
View.OnClickListener() {
@Override
public
void
onClick(View view) {
Snackbar.make(view,
"Replace with your own action"
, Snackbar.LENGTH_LONG)
.setAction(
"Action"
,
null
).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle =
new
ActionBarDrawerToggle(
this
, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(
this
);
View headerView = navigationView.getHeaderView(
0
);
txtFullName = headerView.findViewById(R.id.txtFullName);
txtFullName.setText(Common.currentUser.getName());
recycler_menu = (RecyclerView)findViewById(R.id.recycler_menu);
recycler_menu.setHasFixedSize(
true
);
layoutManager =
new
LinearLayoutManager(
this
);
recycler_menu.setLayoutManager(layoutManager);
loadMenu();
}
private
void
loadMenu() {
adapter =
new
FirebaseRecyclerAdapter<Category, MenuViewHolder>(Category.
class
,R.layout.menu_item,MenuViewHolder.
class
,category) {
@Override
protected
void
populateViewHolder(MenuViewHolder viewHolder, Category model,
int
position) {
viewHolder.txtMenuName.setText(model.getName());
Picasso.with(getBaseContext()).load(model.getImage())
.into(viewHolder.imageView);
final
Category clickitem = model;
viewHolder.setItemClickListener(
new
ItemClickListener() {
@Override
public
void
onClick(View view,
int
position,
boolean
isLongClick) {
Intent articleList =
new
Intent(Home.
this
,ArticlesListe.
class
);
articleList.putExtra(
"CategoryId"
,adapter.getRef(position).getKey());
startActivity(articleList);
}
});
}
};
recycler_menu.setAdapter(adapter);
}
@Override
public
void
onBackPressed() {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
if
(drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
}
else
{
super
.onBackPressed();
}
}
@Override
public
boolean
onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home, menu);
return
true
;
}
@Override
public
boolean
onOptionsItemSelected(MenuItem item) {
return
super
.onOptionsItemSelected(item);
}
@SuppressWarnings
(
"StatementWithEmptyBody"
)
@Override
public
boolean
onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int
id = item.getItemId();
if
(id == R.id.nav_menu) {
// Handle the camera action
}
else
if
(id == R.id.nav_cart) {
}
else
if
(id == R.id.nav_orders) {
}
else
if
(id == R.id.nav_log_out) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return
true
;
}
logcat
03
-
29
10
:
30
:
41.311
1684
-
1727
/com.example.di_prn.ganigazapp E/EGL_emulation: tid
1727
: eglSurfaceAttrib(
1174
): error
0x3009
(EGL_BAD_MATCH)
03
-
29
10
:
30
:
43.240
1684
-
1727
/com.example.di_prn.ganigazapp E/EGL_emulation: tid
1727
: eglSurfaceAttrib(
1174
): error
0x3009
(EGL_BAD_MATCH)
03
-
29
10
:
30
:
47.852
1684
-
1684
/com.example.di_prn.ganigazapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.di_prn.ganigazapp, PID:
1684
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.di_prn.ganigazapp/com.example.di_prn.ganigazapp.Home}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to
false
in your theme to use a Toolbar instead.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2665
)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2726
)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1477
)
at android.os.Handler.dispatchMessage(Handler.java:
102
)
at android.os.Looper.loop(Looper.java:
154
)
at android.app.ActivityThread.main(ActivityThread.java:
6119
)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
886
)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
776
)
Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to
false
in your theme to use a Toolbar instead.
at android.support.v7.app.AppCompatDelegateImplV9.setSupportActionBar(AppCompatDelegateImplV9.java:
201
)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:
129
)
at com.example.di_prn.ganigazapp.Home.onCreate(Home.java:
51
)
at android.app.Activity.performCreate(Activity.java:
6679
)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1118
)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2618
)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2726
)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1477
)
at android.os.Handler.dispatchMessage(Handler.java:
102
)
at android.os.Looper.loop(Looper.java:
154
)
at android.app.ActivityThread.main(ActivityThread.java:
6119
)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
886
)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
776
)
Reply
Answers (
3
)
Authentication problem
How to make glide work in gradle