简体   繁体   中英

Wrong Resource values Android?

I am working with an android project and having images in a library project for which i have created a JAR file.

The sequence of images in drawable folder in JAR file is as:

image1
image2

Now in my Application, The drawable folder has following sequence of images:

image3
image4
image1

Now if i want to pick the drawable from library code As R.drwable.image1, It picks image3 from my Applications Drawable folder and displays it.

In case if image1 is above image3 it displays it image correctly.

I don't know why I am getting this problem of ordering. I am using android SDK revision 18. I have created a JAR using "FatJar" plugin in eclipse.

I'm not sure why it picks image3 even though you chose R.drawable.image1 ..

but try this

R.drwable.image1[1]

update:

NotificationCompat.Builder mBuilder =
        new NotificationCompat.Builder(this)
        .setSmallIcon(R.drawable.icon)
        .setContentTitle("My notification")
        .setContentText("Hello World!");
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, ResultActivity.class);

// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(ResultActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
        stackBuilder.getPendingIntent(
            0,
            PendingIntent.FLAG_UPDATE_CURRENT
        );
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
    (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(mId, mBuilder.build());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM