I'm very new to Android studio and I'm currently following a tutorial that implements a sliding tab layout for an application. The tutorial says to put
SlidingTabLayout.java and SlidingTabStrip.java in our project, but doesn't say exactly where. For now, I just put declared them as two classes and put them under the java folder. (...app\src\androidTest\java). However, when I try to include a SlidingTabLayout object in my xml file, it says "The following classes could not be: found:com.android4devs.slidingtab.SlidingTabLayout", which means I must have put those two files in the wrong place. Anybody used these files before and know where to put them?
Thank you
The error says could not found the SlidingTabLayout class. Which means you have to tell correctly where the SlidingTabLayout file placed.
in xml change com.android4devs.slidingtab to your package name. You can find your package name in SlidingTabLayout.java or in manifest file.
Related
I want to use my "Final_Frame.java" in my "SampleFrameProject.java", sort of like interconnecting it by creating a "Final_Frame" object and then typing the "this.show()".
However, an error message appears, saying that "package com.toedter.components does not exist." That is the only error I've seen; I'm confident that my "Final Frame.java" is functioning well before I copy-paste it, hence I knew the issue was caused by my copy-pasting.
Btw all of the error is pointing to JCalender, and JComponents, I'm pretty sure I followed the instructions while installing them. They are working just fine before I move the "Final_Frame.java", but after I move it, it began to show errors. So is there any way for me to copy-paste it correctly? or are there any methods to call "Final_Frame.java" inside my "SampleFrameProject.java" without copy-pasting?
Thank you in advance!
package is a fundamental concept in Java. It is nothing but a namespace for the Java source file, reflecting the directory (folder) structure of your project after the src/main/java directory.
package is usually defined at the first line of the file. For example, given the directory structure from your root directory mavenproject2, the directory structure inside if it is src/main/java/com/foo/bar/FinalJava.java, then the corresponding package defined will be
package com.foo.bar;
// imports
public class FinalJava {
// the content of class
}
For your case, it would seem that you have copied com/toedter/components/FinalFrame.java from the Hotel_Management_System project (which already has defined a line package com.toedter.components in the file) to another project mavenproject2 which has a different directory structure (which is not clear in your question).
The solution would be to modify the package line according to your directory structure then it would solve the error.
Personally, I would suggest to learn some basics in Java, take some tutorials, or at least write some simple Java console applications before diving into GUI applications.
I extend ConstraintLayout class for special purpose.
and I use this class in layout xml file.
not problem show layout.xml with text mode.
but try show layout.xml with Design mode,
android studio show me this message.
I already try 'Refresh', 'rebuild', 'clean build'.
but still show 'Missing classes'.
how can I fix this problem?
The problem is that you are referencing to a class that doesn't exist or is not where you are referencing to.
You can either fix the path by
Copying the class to the correct folder.
Fixing the path by clicking on Fix build path
Or, click on Create Class and copy everything you had in previous class into the new one.
I think the 3rd option will be the easiest for you.
I am new to programming and trying to learn android development with android studio. I updated Java and tried to update android SDK when it crashed. I finally got the Android SDK update fixed but now I have this error in an app I was working on. It's in the activity_main.xml file
The error says "cannot resolve this symbol: MainActivity.java"
Here's the line where the error shows up.
tools:context="com.example.android.justjava.MainActivity.java"
MainActivity.java is red. I feel like it's directory tree issue, but I can't tell what the program wants so I can fix it.
Remove .java at the end, and make sure that MainActivity.java exists inside the package com.example.android.justjava.
What is the purpose of writing that line?
tools:context
This attribute is typically set on the root element in a layout XML
file, and records which activity the layout is associated with (at
designtime, since obviously a layout can be used by more than one
layout). This will for example be used by the layout editor to guess a
default theme, since themes are defined in the Manifest and are
associated with activities, not layouts.
Source: http://tools.android.com/tech-docs/tools-attributes
I need to start an activity in my titanium module.Then I have to setContent of my Layout in my pure java code, But I cannot locate the layout file in Titanium module.
I used below code but i get error that file not found.
int id = TiRHelper.getApplicationResource("layout.activity_main");
If i put my layout files inside "platform/android/res" i get error,any idea to help me?
invalid resource directory name:
[ERROR] Error generating R.java from manifest
Regards
Might have nothing to do with it but I once ran across this problem and solved by putting the application id in the com.company.app format
If your XML's contain errors your generated file might not build try erasing most of their content and making sure id's and file names are not duplicated and no capitals and spaces are used. If it works you can start adding stuff.
(or)
You're importing invalid R class I Think,
import yourpackage.R class
for example
com.example.R
what actully happends that u import android.R class not yourpackages.R
I'm trying to run theme studio for jscookmenu, by double-clicking the file js-cook-menu_2.30.jar. But when I do that, I get the following message:
"Failed to load Main-Class manifest attribute from C:\dev\tapestry-jsmenu_2.30\js-cook-menu_2.30.jar"
After searching on the internet, I found that it is necessary to specify a main class in the file manifest.mf of a jar file in order to run it. I thought that if I modified js-cook-menu_2.30.jar and I add a manifest.mf specifying a class with a main method, I could run the program.
I looked on the source code provided with the downloadable package, but no success.
Could someone help me with this?
Your error is exactly what it says it is. A main class and a main method of another class are very different things. Per your error message, the documentation and what you found from looking you need to add a main class, so that's what I would recommend doing.