adding jodo to android project - android

I am a newbie to java and android world, and I want to use 'Period ' class of 'jodo' project to calculate the differences between to dates.
I imported 'joda-time-2.1.jar' like what I read in this manual. It added a lot of pckages with white icon beside every package into 'src' folder. But when I want to use a code like the following :
Period p = new Period(startDate, endDate);
The eclipse ide cant recognize the 'jodo' package, and even if I type
import jodo.org.joda.time.*;
it will not help to make 'Period' recognizable for ide.
Regards.

i think this should recognize the Period class:
import org.joda.time.Period;

Related

Cannot locate ChangeText class/symbol

I am trying to add some animation in my Android app for a text change on a TextView.
I found a post with sample:
Smooth text change in android animation
Sample code:
TransitionManager.beginDelayedTransition(transitionsContainer,
new ChangeText().setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN));
I have imported the following package:
import androidx.transition.TransitionManager;
However, when I use this, I get an error in Android Studio: Cannot resolve symbol ChangeText
What am I missing? Please help!
The original Answer mentions that a library is needed:
If you want to support Android 4+. check out the Transitions Everywhere lib. You can achieve all sorts of different animations with backward compatibility.
Here you can find some examples.
Therefore you might need to install the library via gradle and then import it like so:
import com.transitionseverywhere.ChangeText;
or
import com.transitionseverywhere.*;

Hello world android - creation with errors

I'm trying to create my first app with Android but I've encountered some problems.
Following a tutorial and making:
new android application -> blank activity
The default result should be:
With MainActivity.java and R.Java inside it.
But instead I've got this:
There are a lot of errors and the R.Java file is missing.
I can obtain a result similar to the tutorial one (with no errors), creating a new android application and unchecking create activity, but this time MainActivity.java under src is totally missing.
Maybe I could copy the MainActivity.java of the first project and put into the second one, but I prefer understand why it doesn't work.
Thanks for the help.
Best regards.
its import library problem
Right click on you application----->Android
under library view ,
check if you have this red error then remove the library and add it again

Android: cannot find symbol for my own imported class

Okay, this is driving me absolutely nuts. Relevant info:
I'm using Android Studio
I'm trying to set up a gaussian blur from here: https://stackoverflow.com/a/14556162/2170400
In my src/com/myprojectname folder I have, among others, the following files: AndroidImage.java, IAndroidFilter.java, ConvolutionMatrix.java and GaussianBlur.java. In IAndroidFilter.java I need to
import com.myprojectname.AndroidImage;
However I get a message saying "Cannot resolve symbol 'AndroidImage'". In the auto-complete menu that pops up while I'm typing the import statement I can see EVERY SINGLE CLASS in my src/com/myprojectname folder EXCEPT AndroidImage, which I can clearly see in the explorer.
I've quit and re-opened Android Studio several times, I've re-synced everything, I've deleted then re-created the AndroidImage class, I've tried to import AndroidImage in other classes with the same failed result as in the IAndroidFilter class...
Why is it that I can't import this class? Seriously, why? I'm at a total loss for further fixes to try.
Check to make sure your AndroidImage.java file has this at the top:
package com.myprojectname.AndroidImageProject;
Or whatever the package is.

new to android not sure what import info.androidhive.imageslider.R; means

I have been working through this tutorial and came across this code:
import info.androidhive.imageslider.R;
This is important because when i copy these files from this tutorial into a new project - it gives me an error on this line of code.
can you give me a detailed explanation on what it means?
This is the import of your resource library. Resource means where your app store its drawable, layout etc. In most cases, it is under the packages name like:
if your package name is: info.androidhive.imageslider
then, your resource package name will be info.androidhive.imageslider.R
When you open a new android project, your must notice that there is a gen folder where there is a R.java file. This import actually import that file to the class where you may use some resource.
As you copied the code from other places, I think you have changed your project package name and so for that, now the app can't match it with current package for R file. Please, check it and change it according to it.
Hope it may help you.
You got this explained in the tutorial (btw: it's good to read tutorial, not just copy files from it):
I kept my package name as info.androidhive.imageslider
You must have proper import here. If you are using Eclipse, best solution would be to press CTRL+Shift+o.

Trouble compiling and running a basic program in eclipse for android

this is a real basic question, but I am having a frustrating time learning how to compile/run an android pong program from a website. The tutorial I am following is here - http://mikeyhogarth.wordpress.com/2010/10/09/how-to-develop-pong-for-android/
I keep trying, and I am getting errors. I am new to android (but not programming) so I am having trouble identifying the problem.
Also the tutorial mentions layout.xml, but I do not see a layout.xml in eclipse, I see a main.xml, is that the same thing?
Attached is my screenshot with errors. Suggestions? Have I configured eclipse/java/android wrong? Is there a problem with the tutorial? I appreciate links to any other good game/graphic based starting tutorials you may have to offer.
Screenshot here
Looks like you need to declare your package in your java files like so:
package com.mikey.pong;
public class GameState {
//screen width and height
final int _screenWidth = 300;
final int _screenHeight = 420;
....
Looks like the tutorial assumed you would provide this.
and yes, your main.xml file is considered a layout, hence living in the layout dir.
It seems that you didn't import the classes contained in the android SDK to your project. In eclipse, press CTRL+SHIFT+O to invoke the import feature.
It looks like you need to add import statements to the classes you've copied from the tutorial. Double clicking on one of the errors (i.e. SurfaceHolder cannot be resolved to a type) should take you to it's place in the code. Hovering over where it says SurfaceHolder for a moment should pop-up something that will allow you to "Import 'SurfaceHolder' (android.view)". Try doing that and see if it starts getting rid of some of those errors.

Categories

Resources