Adding new image to Xamarin Android changes all other images - android

I'm new to Xamarin and I'm facing strange issue that whenever i try to add new image to Resources/drawable folder of Android and referring it to shared code,all other images are getting change and starts referring random images.
Steps which I'm following :
Add a new Image to Resources/drawable folder.
Change Build Action to "AndroidResources".
And referring the new image in Source attribute.
thanks in advance.

Looks like your Android resource generated file was not re-generated or broken. Try Clean-Build Android project. If that doesn't help, delete bin and obj folders and try building again.

Related

Android drawable resources getting created in a debug folder?

I'm building an Android app using Android Studio & Kotlin. Historically, when I've added new image drawbles:
they were saved to the following folder: \app\src\main\res
However, recently (potentially after an Android Studio update?) new image drawables now wind up here: \app\src\debug\res. I haven't intentionally meant for that to happen. Now my drawables are split between the two locations. What caused this change? How do I switch it back?
You need to select the right "Res Directory", "main" when adding the drawable:

ARToolkit: Created new .pat file doesn't work

I'm using ARToolkit in my Android project. I used this to help me create a new marker and everything worked fine. The file created was called marker64.pat. However, the standard pattern files that ARToolkit uses are .patt files (with the extra t). Why did it create a .pat file for me?
This .pat file doesn't seem to work, as it crashes my application just as it starts.
This is the original line of code that was already there (which works fine):
markerID = ARToolKit.getInstance().addMarker("single;Data/hiro.patt;80");
This is my changed version:
markerID = ARToolKit.getInstance().addMarker("single;Data/marker64.pat;80");
This is my marker image whilst I'm creating the marker:
Can you please let me know why, firstly, my file was created as .pat file and not a .patt file. And secondly, why this file doesn't work if it's correct.
Thanks

No resource found that matches #drawable/test err android studio

I've tried all solutions. Finally decided to post this question.
The situation is as follows:
My drawable has test.png image which I use in my project.
In eclipse it works perfectly but in Android Studio it doesn't work.
Also I'm not getting any compiler error.
I am getting only this type of error almost 54 times when cradle build. As this image is set of as background to 54 screens. :(
What could be the problem?
You should remove the extension part.
For example if your image is called mimg.png in your
resource files you should access it via #drawable/mimg.
Edit
If in eclipse is fine, then create the project new and add file by file. I also had this issues and after some tries ai gave up and created new and after added file by file.
As an alternative please check if you add it in other drawables folders.
That's it.
You need to reference your drawable without the extension: Like this:
android:src="#drawable/test"
Remove the image extension from your xml file and try that please!

How to accès images from drawable folder?

Im trying to create gallery application. In tutorial I've found, I need to do get images using R.drawable.image_name. I've created folder drawable under /res folder, copied my images one by one into that folder, al of them are .png. But when I try to access them by writing R.drawable.image I can't do that because there is no images I've copied. How to fix it?
Clear and rebuild your project. If you got automatic builds disabled, your IDE will not refresh R class contents and won't autocomplete your assets IDs.
Do clean build or if you are using android studio do invalidate cache and make project afterwards.
For Accessing Drawable:
Drawable drawable = this.getResources().getDrawable(R.drawable.image_name);
If you want bitmap :
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.image_name);
if you want to access by url :
imgUrl= "drawable://" + R.drawable.image_name;

Why am I not able to create android xml file?

I am creating a new project, target of this project is "GALAXY tab addon". I am creating a new xml file in layout folder an I am getting following screen which was not the case when I was developing for 2.2 or so. Where do I go next, it says the options are "optional" so I skipped them and clicked finish- No Response, I also tried selecting some options and still the file is not creating. What am i missing here?
IDE used is Eclipse.
You dont need to go till this window.you can finish creating xml file before this window like the below image.
Just click on finish button here and your xml file will be created.

Categories

Resources