PhoneGap SplashScreen - splash cannot be resolved or is not a field - android

i want to make a splash screen on my android application, i use phonegap.
here is my main.java code :
public class App extends DroidGap {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl("file:///android_asset/www/index.html",5000);
}
}
but i got an error : "splash cannot be resolved or is not a field"
i've put the splash.png on every drawable directories, but the error still there..
anybody could help me? thanks in advance..

I think there is an issue about the timeout parameter in your case 5000 and it was fixed in phonegap 1.6.0 release that's why you don't get it work:
these links confirms that
How to use OpenStreetMap/OpenLayers?
phonegap - splash screen for Android app
try to use the last phone gap release (1.8.1) and you will get it work

just change the word splash by screen:
super.setIntegerProperty("splashscreen", R.drawable.screen);

I was having a similar problem. I renamed the package which extended the core DroidGap class. My solution was fixed by this solution: http://www.youtube.com/watch?v=3CHRujojc2o. In short, make sure to update your references in the AndroidManifest.xml file to point to the new package name.

Related

Controls showing in designer but not in emulator

This is my first Xamarin app. I have my environment set up in Visual Studio, and have a template project which I can run in the Android emulator.
Having dragged and dropped a couple of controls on to the designer surface, I find that when I run the application in the emulator, neither of the two controls that I have added (a button and a switch) display in the emulator.
I have tried:
Cleaning the solution
Rebuilding the solution
Manually deleting bin and object files
Unchecking 'Use Fast Deployment' in project Android Options
Uninstalling from the emulator
But with the same result each time.
[Project files removed]
Am I missing something?
Just downloaded your code and ran it. Uncommenting SetContentView (Resource.Layout.Main); it worked to me.
[Activity(Label = "Tgo.AndroidApp", MainLauncher = true, Icon = "#drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
}
}
Here a nice guide to get you started with Xamarin Android.
navigate to MainActivity.cs and uncomment this code
SetContentView (Resource.Layout.Main);
and rebuild the solution and debug.
Let me know it if helps!
In my case, I had to update my Main.xml file with the updates I put into the Main.axml and Rebuild.

Android studio and R class

I've a little problem with android studio. Until yesterday I used Eclipse. But today I start to use Android studio. I write a simple layout without errors. Than in src/main/java I write this simple code:
public class MyActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(android.R.layout.activity_my);
}
}
But I've an arror: "cannot resolve symbol activity_my"
According to me the layout isn't registrated in R.java. How can I resolve this problem? Thanks in advance :D
p.s. sorry for my bad english >.<
Use R and not android.R. Check that the imported R is your.package.name.R.
you should always use setContentView(R.layout.activity_my);.
so replace setContentView(android.R.layout.activity_my); with setContentView(R.layout.activity_my);
USE CTR + SHIFT + o to organize your import statements in eclipse.

Should I Use CordovaWebView or AndroidWebView in my android native App?

I am making a few simple applications for android platform using Phonegap. I used to use the Android WebView to display the html files put in the assets directory like this ....
public class MyQuiz extends DroidGap
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
Soon.. I came to know that this can be done using Cordova Web View too. Is there any difference between the two? Like Performance, Look & feel or anything else? Is my approach Right ?
Here are some useful links which will help you out to understand the exact difference between AndroidWebView and CordovaWebView
https://stackoverflow.com/a/11297966/2266525
http://wiki.apache.org/cordova/CordovaWebView
http://docs.phonegap.com/en/2.2.0/guide_cordova-webview_android.md.html

Error in PhoneGap program "Web page not available"

package com.phonegap;
import org.apache.cordova.*;
import android.os.Bundle;
public class PhoneGapSampleActivity extends DroidGap {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("assets/www/index.html");
}
}
I use this code for PhoneGap application..
But it shows an error.
I added index.html file in assets/www folder.
But it shows an error ...
Anyone can help me??
Thanks in advance.
You forgot the file:///. Keep in mind it's important to have the three slashes!
Also I think it should be android_asset and not asset.
In my app it is: "file:///android_asset/www/index.html"
Simple Google search came to this :
phonegap doesn't work
The solution was to rename phonegap.0.9.4.js and phonegap.0.9.4.jar to just phonegap.jar and phonegap.js.

Android/PhoneGap debugging: app not updated

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.

Categories

Resources