I am trying to add the Pinit button to my Android App. I have downloaded the SDK and copied the pinit-sdk-1.0.Jar into my Project/libs folder. I'm even able to make the necessary PinItButton import to my code. But for whatever reason, my XML isn't finding the Button widget, and so I tried to add it just using Java with this code:
LinearLayout ll = (LinearLayout)findViewById(R.id.pinterest_layout);
PinItButton pinit = new PinItButton(this);
ll.addView(pinit);
I know this is the correct way to add something using code because I tested it by adding a generic Button first. I run my project then, and it crashes on the line where I set up the PinItButton. This is the error that my logcat spat back at me:
07-22 01:19:52.160: E/AndroidRuntime(32367): java.lang.NoClassDefFoundError: com.pinterest.pinit.PinItButton
I believe that I'm understand what it is telling me, but what else should I be attempting then to create the PinIt button? Any help would be great. Thank you!
It was #Kai who helped me figure out my problem. I needed to check my libraries. I did that by going to project --> Properties --> Java Build Path --> Order and Export tab, then checking the library and clicking OK. My problem was then solved!
Related
I'm trying to create a simple paint app using the Android Paint module.
When running my app, it gives me an error in "Run", saying that there's a problem at line 14, which is the line which by default is created in my mainActivity:
setContentView(R.layout.activity_main);
None of it is underlined in my code, I can't find any errors at all in my code (including in my activity_main.xml!).
MainActivity.java: https://pastebin.com/zhEbBYdQ
activity_main.xml:https://pastebin.com/jPsA0gMX
CanvasView.java: https://pastebin.com/GctVDz5B
Any ideas? I've tried clean + rebuild, I've tried com.example.R etc.
Full error log: https://pastebin.com/26TebLhy
Thanks in advance. (New to StackOverflow - I have problems putting in code directly to these posts so I hope PasteBin is okay).
CanvasView is in the package evansspeak.paint1, in main_activity however you are trying to inflate it from *com*.evanspeak.Paint1. Fix either one to be the same.
Check that the case matches as well (preferably all lower case)
I have just installed Android Studio on my pc, but I am not able to find any activity or layout file on a creation of a new project.
Here is the screen shot
From the screen-shot it is clear that you haven't created any project yet. Go to file - Click on : New - Click on : New Project.
Now create a project which will get you all the necessary elements like activities, layouts, gradle, etc.
Happy coding.
Im getting this error message. I created a new project and hit debug to test it. I added nothing and i get this pop up message. what could be my issue? I can create a new blank project wtih out the Controllers and Models projects in them it debugs just fine. But i need to use this solution provided to me.
New to mono droid any help will be apreciated.
You issue could be that none of the projects have been set to be deployed to a device.
Right click your Solution > Properties > Configuration Properties > Tick The Deploy checkbox for your Application Project if not already.
Also make sure to mark one of your activities with MainLauncher = true, otherwise Android does not know which Activity to start first. This is done in the [Activity()] attribute like so:
[Activity(Label = "Epic Activity", MainLauncher = true, Icon = "#drawable/icon")]
public class Activity1 : Activity {}
what could be my issue?
You are using Visual Studio... Android plays much nicer with Eclipse.
Kidding aside, every Android application requires an AndroidManifest.xml file. It looks like you are using MonoDroid, and there are docs about creating the manifest file.
Also, make sure you have built the project.
AndroidManifest.xml is generated as part of the build process, and the XML found within Properties\AndroidManifest.xml is merged with XML generated based on custom attributes.
I'm having trouble getting Eclipse to see that I've just put a new image into my project when referencing that image using R.drawable.this_text
So I drag my png into myProject/res/drawable-hdpi in Eclipse's Project Explorer. The name of the image is this_text and it's a png!
So I go into my application and I want to put this on the screen; So here's the code for that...
private void setTitle()
{
ImageView title = new ImageView(this); //this extends activity
title.setBackgroundResource(R.drawable.this_text);
...
}
This I have done before and each time I do it I experience the same thing:
if i just dragged my this_text.png into the Project Explorer in eclipse, the word "this_text" will be underlined in red, and not allow me to compile or proceed. I try to F5 (refresh) the project. I try refreshing the image foldr, the src, the actual java...etc! I try closing and opening eclipse but nothing really works. So I quit for afew minutes and work elsewhere in my application, and eventually this error goes away!
Well I'm impatient today-- And I'd rather know how to solve this incase I need to do any quick programming! So does anyone know what to do?
I'm using eclipse Version: Indigo Service Release 1.
Thanks- Ethan
R files for android are generated. Rather than refreshing you should be able to CLEAN the project which should fix your issue. You could even just delete the error from the problems list which would allow for compilation to start and for the generated R file to be created. Or you could make a change to an xml which would also allow for the file to be regened. As always make sure you are up to date on your tool chain.
I'm trying to use PhoneGap with Android. In the Sample that I run the main app opens an html file:
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
Now if I change something in the html page, Android always shows the previous content.
Is it possible that the output files (resources in that case) are not updated?
Also if I change the name of the html file in /assets/newName.html and into .loadUrl nothing changes.
Thank you, F.
I'm determined to find a proper answer to this, at the moment changes in the assets dir do not trigger a rebuild.
At the moment I'm slapping a new line in the Activity.java code to force a rebild/deploy..
Will update once I've looked for a real solution.
I see this sometimes when I add a data file to a project in eclipse.
If you think you pkg isnt being updated (re-built) then just rebuild it manually. If your using eclipse just do project->clean and select the project you want to clean. it'll rebuild automatically and include anything that was missed out.
OK Guys found.
The tutorial in the wiki.phonegap.com is obsolete.
Samples instead are updated!
Many thanks.