0
I created a Navigation Drawer following an example, but I would like to know why this error, have how to know by log?
10-27 10:50:26.045: W/Trace(18420): error opening trace file: No such file or directory (2)
10-27 10:50:26.195: D/libEGL(18420): loaded /system/lib/egl/libEGL_mali.so
10-27 10:50:26.200: D/libEGL(18420): loaded /system/lib/egl/libGLESv1_CM_mali.so
10-27 10:50:26.200: D/libEGL(18420): loaded /system/lib/egl/libGLESv2_mali.so
10-27 10:50:26.205: E/(18420): Device driver API match
10-27 10:50:26.205: E/(18420): Device driver API version: 17
10-27 10:50:26.205: E/(18420): User space API version: 17
10-27 10:50:26.205: E/(18420): mali: REVISION=Linux-r3p1-01rel1 BUILD_DATE=Tue Jul 2 15:06:24 KST 2013
10-27 10:50:26.220: D/OpenGLRenderer(18420): Enabling debug mode 0
10-27 10:50:28.140: D/AndroidRuntime(18420): Shutting down VM
10-27 10:50:28.140: W/dalvikvm(18420): threadid=1: thread exiting with uncaught exception (group=0x41c1e930)
10-27 10:50:28.150: E/AndroidRuntime(18420): FATAL EXCEPTION: main
10-27 10:50:28.150: E/AndroidRuntime(18420): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidbegin.parselogintutorial/com.androidbegin.parselogintutorial.Welcome}: android.content.res.Resources$NotFoundException: File Sharing Fuel from drawable resource ID #0x7f0a0013
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.access$600(ActivityThread.java:153)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.os.Handler.dispatchMessage(Handler.java:99)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.os.Looper.loop(Looper.java:137)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.main(ActivityThread.java:5227)
10-27 10:50:28.150: E/AndroidRuntime(18420): at java.lang.reflect.Method.invokeNative(Native Method)
10-27 10:50:28.150: E/AndroidRuntime(18420): at java.lang.reflect.Method.invoke(Method.java:511)
10-27 10:50:28.150: E/AndroidRuntime(18420): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
10-27 10:50:28.150: E/AndroidRuntime(18420): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
10-27 10:50:28.150: E/AndroidRuntime(18420): at dalvik.system.NativeStart.main(Native Method)
10-27 10:50:28.150: E/AndroidRuntime(18420): Caused by: android.content.res.Resources$NotFoundException: File Sharing Fuel from drawable resource ID #0x7f0a0013
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.Resources.loadDrawable(Resources.java:1997)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.Resources.getDrawable(Resources.java:660)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.support.v4.app.ActionBarDrawerToggle.<init>(ActionBarDrawerToggle.java:207)
10-27 10:50:28.150: E/AndroidRuntime(18420): at com.androidbegin.parselogintutorial.Welcome$1.<init>(Welcome.java:94)
10-27 10:50:28.150: E/AndroidRuntime(18420): at com.androidbegin.parselogintutorial.Welcome.onCreate(Welcome.java:95)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.Activity.performCreate(Activity.java:5104)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
10-27 10:50:28.150: E/AndroidRuntime(18420): ... 11 more
10-27 10:50:28.150: E/AndroidRuntime(18420): Caused by: java.io.FileNotFoundException: Sharing Fuel
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.AssetManager.openNonAssetNative(Native Method)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.AssetManager.openNonAsset(AssetManager.java:429)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.Resources.loadDrawable(Resources.java:1989)
10-27 10:50:28.150: E/AndroidRuntime(18420): ... 18 more
10-27 10:50:29.710: I/Process(18420): Sending signal. PID: 18420 SIG: 9
10-27 10:50:26.045: W/Trace(18420): error opening trace file: No such file or directory (2)
10-27 10:50:26.195: D/libEGL(18420): loaded /system/lib/egl/libEGL_mali.so
10-27 10:50:26.200: D/libEGL(18420): loaded /system/lib/egl/libGLESv1_CM_mali.so
10-27 10:50:26.200: D/libEGL(18420): loaded /system/lib/egl/libGLESv2_mali.so
10-27 10:50:26.205: E/(18420): Device driver API match
10-27 10:50:26.205: E/(18420): Device driver API version: 17
10-27 10:50:26.205: E/(18420): User space API version: 17
10-27 10:50:26.205: E/(18420): mali: REVISION=Linux-r3p1-01rel1 BUILD_DATE=Tue Jul 2 15:06:24 KST 2013
10-27 10:50:26.220: D/OpenGLRenderer(18420): Enabling debug mode 0
10-27 10:50:28.140: D/AndroidRuntime(18420): Shutting down VM
10-27 10:50:28.140: W/dalvikvm(18420): threadid=1: thread exiting with uncaught exception (group=0x41c1e930)
10-27 10:50:28.150: E/AndroidRuntime(18420): FATAL EXCEPTION: main
10-27 10:50:28.150: E/AndroidRuntime(18420): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidbegin.parselogintutorial/com.androidbegin.parselogintutorial.Welcome}: android.content.res.Resources$NotFoundException: File Sharing Fuel from drawable resource ID #0x7f0a0013
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.access$600(ActivityThread.java:153)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.os.Handler.dispatchMessage(Handler.java:99)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.os.Looper.loop(Looper.java:137)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.main(ActivityThread.java:5227)
10-27 10:50:28.150: E/AndroidRuntime(18420): at java.lang.reflect.Method.invokeNative(Native Method)
10-27 10:50:28.150: E/AndroidRuntime(18420): at java.lang.reflect.Method.invoke(Method.java:511)
10-27 10:50:28.150: E/AndroidRuntime(18420): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
10-27 10:50:28.150: E/AndroidRuntime(18420): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
10-27 10:50:28.150: E/AndroidRuntime(18420): at dalvik.system.NativeStart.main(Native Method)
10-27 10:50:28.150: E/AndroidRuntime(18420): Caused by: android.content.res.Resources$NotFoundException: File Sharing Fuel from drawable resource ID #0x7f0a0013
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.Resources.loadDrawable(Resources.java:1997)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.Resources.getDrawable(Resources.java:660)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.support.v4.app.ActionBarDrawerToggle.<init>(ActionBarDrawerToggle.java:207)
10-27 10:50:28.150: E/AndroidRuntime(18420): at com.androidbegin.parselogintutorial.Welcome$1.<init>(Welcome.java:94)
10-27 10:50:28.150: E/AndroidRuntime(18420): at com.androidbegin.parselogintutorial.Welcome.onCreate(Welcome.java:95)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.Activity.performCreate(Activity.java:5104)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
10-27 10:50:28.150: E/AndroidRuntime(18420): ... 11 more
10-27 10:50:28.150: E/AndroidRuntime(18420): Caused by: java.io.FileNotFoundException: Sharing Fuel
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.AssetManager.openNonAssetNative(Native Method)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.AssetManager.openNonAsset(AssetManager.java:429)
10-27 10:50:28.150: E/AndroidRuntime(18420): at android.content.res.Resources.loadDrawable(Resources.java:1989)
10-27 10:50:28.150: E/AndroidRuntime(18420): ... 18 more
10-27 10:50:29.710: I/Process(18420): Sending signal. PID: 18420 SIG: 9
Activity Welcome.java
package com.androidbegin.parselogintutorial;
import java.util.ArrayList;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import br.isckosta.sharingfuel.adapter.NavDrawerListAdapter;
import br.isckosta.sharingfuel.model.NavDrawerItem;
import br.isckosta.sharingfuel.slidingmenu.AddNewPostFragment;
import br.isckosta.sharingfuel.slidingmenu.FeedFragment;
import com.parse.ParseUser;
public class Welcome extends Activity {
// Declare Variable
Button logout;
private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
private ActionBarDrawerToggle mDrawerToggle;
private CharSequence mDrawerTitle;
private CharSequence mTitle;
private String[] navMenuTitles;
private TypedArray navMenuIcons;
private ArrayList<NavDrawerItem> navDrawerItem;
private NavDrawerListAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTitle = mDrawerTitle = getTitle();
// Carrega os titulos do menu
navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
// Carrega os icones do drawer nas resources
navMenuIcons = getResources()
.obtainTypedArray(R.array.nav_drawer_icons);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.list_slidermenu);
navDrawerItem = new ArrayList<NavDrawerItem>();
// Adicionando itens do Nav Drawer para o Array
// Feed
navDrawerItem.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons
.getResourceId(0, -1), true, "22"));
// Adicionar novo Post
navDrawerItem.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons
.getResourceId(1, -1)));
// Recycled typed array
navMenuIcons.recycle();
mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
// Configurando o adapter list para o nav drawer
adapter = new NavDrawerListAdapter(getApplicationContext(),
navDrawerItem);
mDrawerList.setAdapter(adapter);
// enabling action bar app icon and behaving it as toggle button
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer, R.string.app_name, R.string.app_name) {
@Override
public void onDrawerClosed(View drawerView) {
getActionBar().setTitle(mTitle);
invalidateOptionsMenu();
}
@Override
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
invalidateOptionsMenu();
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
if (savedInstanceState == null) {
displayView(0);
}
/**
* Slide menu item click listener
* */
// Sessão de recuperação de usuário do Parse
ParseUser currentUser = ParseUser.getCurrentUser();
// String struser = currentUser.getUsername().toString();
// TextView txtuser = (TextView) findViewById(R.id.txtuser);
// txtuser.setText("You are logged in as " + struser);
//
// logout = (Button) findViewById(R.id.logout);
logout.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// Logout current user
ParseUser.logOut();
finish();
}
});
}
private class SlideMenuClickListener implements
ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
displayView(position);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// toggle nav drawer on selecting action bar app icon/title
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
// Handle action bar actions click
switch (item.getItemId()) {
case R.id.action_settings:
return true;
default:
return super.onOptionsItemSelected(item);
}
}
/* *
* Called when invalidateOptionsMenu() is triggered
*/
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
menu.findItem(R.id.action_settings).setVisible(!drawerOpen);
return super.onPrepareOptionsMenu(menu);
}
private void displayView(int position) {
// Atualizar o conteudo do substituindo os fragments
Fragment fragment = null;
switch (position) {
case 0:
fragment = new FeedFragment();
break;
case 1:
fragment = new AddNewPostFragment();
break;
default:
break;
}
if (fragment != null) {
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.frame_container, fragment).commit();
// update selected item and title, then close the drawer
mDrawerList.setItemChecked(position, true);
mDrawerList.setSelection(position);
setTitle(navMenuTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
} else {
Log.e("Welcome", "Error in creating fragment");
}
}
@Override
public void setTitle(CharSequence title) {
mTitle = title;
getActionBar().setTitle(mTitle);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
}
10-27 12:07:41.710: E/(28528): Device driver API match 10-27 12:07:41.710: E/(28528): Device driver API version: 17 10-27 12:07:41.710: E/(28528): User space API version: 17 10-27 12:07:41.710: E/(28528): Mahli: REVISION=Linux-r3p1-01rel1 BUILD_DATE=Tue Jul 2 15:06:24 KST 2013 10-27 12:07:43.470: E/Androidruntime(28528): FATAL EXCEPTION: main 10-27 12:07:43.470: E/Androidruntime(28528): java.lang.Runtimeexception: Unable to start Activity Componentinfo{com.androidbegin.parselogintutorial/com.androidbegin.parselogintutorial.Welcome}: java.lang.Nullpointerexception 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.performLaunchActivity(Activitythread.java:2308) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.handleLaunchActivity(Activitythread.java:2358) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.access$600(Activitythread.java:153) 10-27 12:07:43.470: E/Androhidrountime(28528): at android.app.Activitythread$H.handleMessage(Activitythread.java:1247) 10-27 12:07:43.470: E/Androidruntime(28528): at android.os.Handler.dispatchMessage(Handler.java:99) 10-27 12:07:43.470: E/Androhidrountime(28528): at android.os.Looper.loop(Looper.java:137) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.main(Activitythread.java:5227) 10-27 12:07:43.470: E/Androhidrountime(28528): at java.lang.reflect.Method.invokeNative(Native Method) 10-27 12:07:43.470: E/Androhidrountime(28528): at java.lang.reflect.Method.invoke(Method.java:511) 10-27 12:07:43.470: E/Androidruntime(28528): at com.android.Internal.os.Zygoteinit$Methodandargscaller.run(Zygoteinit.java:795) 10-27 12:07:43.470: E/Androidruntime(28528): at com.android.Internal.os.Zygoteinit.main(Zygoteinit.java:562) 10-27 12:07:43.470: E/Androhidrountime(28528): at Dalvik.system.Nativestart.main(Native Method) 10-27 12:07:43.470: E/Androidruntime(28528): Caused by: java.lang.Nullpointerexception 10-27 12:07:43.470: E/Androidruntime(28528): at com.androidbegin.parselogintutorial.Welcome.onCreate(Welcome.java:134) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activity.performCreate(Activity.java:5104) 10-27 12:07:43.470: E/Androhidrountime(28528): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.performLaunchActivity(Activitythread.java:2262) 10-27 12:07:43.470: E/Androidruntime(28528): ... 11 more 10-27 12:07:41.710: E/(28528): Device driver API match 10-27 12:07:41.710: E/(28528): Device driver API version: 17 10-27 12:07:41.710: E/(28528): User space API version: 17 10-27 12:07:41.710: E/(28528): Mali: REVISION=Linux-r3p1-01rel1 BUILD_DATE=Tue Jul 2 15:06:24 KST 2013 10-27 12:07:43.470: E/androidruntime(28528): FATAL EXCEPTION: main 10-27 12:07:43.470: E/Androidruntime(28528): java.lang.Runtimeexception: Unable to start Activity Componentinfo{com.androidbegin.parselogintutorial/com.androidbegin.parselogintutorial.Welcome}: java.lang.Nullpointerexception 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.performLaunchActivity(Activitythread.java:2308) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.handleLaunchActivity(Activitythread.java:2358) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.access$600(Activitythread.java:153) 10-27 12:07:43.470: E/Androhidrountime(28528): at android.app.Activitythread$H.handleMessage(Activitythread.java:1247) 10-27 12:07:43.470: E/Androidruntime(28528): at android.os.Handler.dispatchMessage(Handler.java:99) 10-27 12:07:43.470: E/Androhidrountime(28528): at android.os.Looper.loop(Looper.java:137) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.main(Activitythread.java:5227) 10-27 12:07:43.470: E/Androhidrountime(28528): at java.lang.reflect.Method.invokeNative(Native Method) 10-27 12:07:43.470: E/Androhidrountime(28528): at java.lang.reflect.Method.invoke(Method.java:511) 10-27 12:07:43.470: E/Androidruntime(28528): at com.android.Internal.os.Zygoteinit$Methodandargscaller.run(Zygoteinit.java:795) 10-27 12:07:43.470: E/Androidruntime(28528): at com.android.Internal.os.Zygoteinit.main(Zygoteinit.java:562) 10-27 12:07:43.470: E/Androhidrountime(28528): at Dalvik.system.Nativestart.main(Native Method) 10-27 12:07:43.470: E/Androidruntime(28528): Caused by: java.lang.Nullpointerexception 10-27 12:07:43.470: E/Androidruntime(28528): at com.androidbegin.parselogintutorial.Welcome.onCreate(Welcome.java:134) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activity.performCreate(Activity.java:5104) 10-27 12:07:43.470: E/Androhidrountime(28528): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 10-27 12:07:43.470: E/Androidruntime(28528): at android.app.Activitythread.performLaunchActivity(Activitythread.java:2262) 10-27 12:07:43.470: E/Androidruntime(28528): ... 11 more
This is what’s causing the mistake:
Caused by: android.content.res.Resources$NotFoundException: File Sharing Fuel from drawable resource ID #0x7f0a0013
– ramaral
He is saying that he did not find a resource. Resources$Notfoundexception: File Sharing Fuel from drawable Resource ID #0x7f0a0013
– Tony
How can I know which feature or Resource is missing?
– Israel Sousa
Take a look at line 94 of your class
com.androidbegin.parselogintutorial.Welcome
– Wakim
Look there, I edited there in the question, from line 94.
– Israel Sousa
The third parameter of
ActionBarDrawerToggle
is not aString
, is theDrawable
which will appear as an indicator. Have a look: https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.html.– Wakim
Should it look like this then? mDrawerToggle = new Actionbardrawertoggle(this, R.drawable.ic_drawer, mDrawerLayout, R.string.app_name, R.string.app_name) {
– Israel Sousa
@Israelsousa, No, it should be:
new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.app_name, R.string.app_name)
. Remember that the last two parameters are not the name of your app, they are descriptions for accessibility for the open and close icons.– Wakim
friend I had a similar problem with my app.. was an image on my login screen that I picked up from drawable.... I just changed where I was getting this image that was from drawable to mipmap...
– Tiago