I am new to Android Studio.I like the IDE very much,it has got some nice set of features and has a rich look and feel, however I have some issues with the IDE. I recently created a Cordova application in android studio.I created an HTML file called index.html under assests/www folder.I included my jquery-1.11.3.min.js inside index.html file.I have the habit of checking whether the file jquery-1.11.3.min.js has been correctly included inside HTML file.In eclipse I use cntrl +click to check whether the js file path given is right.But when I use the same thing in Android studio,even if the path is right,it is showing like 'Cannot find declaration to go to'.The screenshot for the same is given below.
Can anyone suggest a solution for this situation.
Related
Xamarin has a RazorTodo sample that demonstrates how to build a hybrid app using WebView and razor. It contains a portable library that contains the views, models, and so forth. However, when adding a program for the portable library, I can't find a template for that. I can create a normal "portable" library, but it doesn't have a "Views" folder. I can create one, but then there's no template for adding .cshtml files. I can create a file of a different type with the .cshtml extension, but it would be nice for VS to know about the type. Am I missing something?
Thanks.
-John
Using a Views folder is just convention. It is perfectly legitimate to just add the folder.
If you are working inside of Xamarin Studio, you can add a .cshtml file to your project by choosing "Preprocessed Razor Template" under "Text Templating" in the "New file" dialog.
Visual Studio doesn't currently include this template type, but you can easily add a Text File or HTML File to your project, named with the .csthml file extension, and turn it into a preprocessed razor template by editing the properties on the file and setting "Custom Tool" to RazorTemplatePreprocessor.
I am wondering if is possible accessing the internal files of an app after build with cordova plugin.
My project is based on Android and here are my files:
index.html
html:
- remove.html
js
css
So, after build the app, I want to access with some option within the app the remove.html and remove it.
I find that the FILE plugin of cordova is useful for files inside the device but not the app.
Please anyone has any idea?
we do not have modification access to the location where apk's internal files are saved. Since your remove.html is part of your app apk, we cannot just remove it.
You can take the same approach taken by sqlite raw database file. When your app is started or run for the very first time, copy your file (remove.html) to data folder where you can modify/delete it. Make sure your app only uses this new path everywhere.
Take a look at copyDatabaseFromAssets function in this code for a sample on how do this. Since you will have modification access, you can delete or modify this file as needed.
I am trying to reference a local html file in my phonegap android app. I am seeing where something like www/myapp_name/somefile.html does not work, is there a away to do this?
You don't have to add the www. If you structure is as follow
/myprojectname/www/index.html
/myprojectname/www/contact.html
And you wish to make a link from index.html to contact.html you can juse use
contact.html
Just use the relative path. Don't add a / up front.
I have a text file "test.txt" under the Resources, and a function "parseSth(char* str)" in the "util.cpp" to read the "test.txt" do something.
However, if I use like this parseSth("text.txt"), the ios and android all cannot find the file. And use parseSth(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("text.txt")) will work fine on ios, but cannot find the path.
Why? How I can do?
I suppose that your file is embedded into APK file on Android and thus doesn't have a path to it per-se.
Use the following function to extract data from the file (it automatically handles apk/sd card differences).
FileUtils::getInstance()->getDataFromFile(filename)
I have built an Android App, using a jQuery Mobile index.html file "wrapped" inside Java using the Android SDK on Eclipse.
However, although the images appear OK within the Dreamweaver "Live" view for jQuery mobile,
they don't appear in the emulator in Android SDK after successful build.
I have added the image files within an image folder in the RES/mpdi folder of the project, and within the index.html file they are referenced as images/"...png" etc
Should I have changed the path in any way in the index.html file?
Also, they are 290x381 pixels - should I have had a different size for the AVD?
Thanks in advance!
David
I will assume you are using something like phonegap
phonegap has a whitelist that tells the app which URLs it's allowed to access. You can also add a * to it, as described http://www.anujgakhar.com/2011/11/22/phonegap-gotcha-error-whitelist-rejection/ found in in the /res/xml/phonegap.xml file