9-patch image stops app to work in Android - android

I have created a 9-patch image (splash.9.png) for my splash screen. The issue is, whenever I use this splash image, the app doesn't go past the splash screen. However, using a non-9patch image makes the app work. The same 9-patch image without that .9 extension also makes the app work. What is possibly wrong??
Code:
public class NafapplicationActivity extends DroidGap {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl("file:///android_asset/www/index.html");
}
}
index.html :
<!DOCTYPE html>
<!--<html manifest="naf.manifest">-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Naf</title>
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
</head>
<body>
Hello World!!
</body>
</html>

Official Rep from PhoneGap says, in response to the question "Does PhoneGap Build support the use of 9-patch images":
The only platform that seems to support them is Android. Since we strive for cross platform currently it seems to be a bit of a toss up. However it is something we may look into further down the road.
Taken from: http://community.phonegap.com/nitobi/topics/does_phonegap_build_support_the_use_of_9_patch_images
So, to answer your question: Your splash doesn't work when it is a .9.png because PhoneGap doesn't, and may never, support 9-patch images because Android is the only major Platform to support them and PhoneGap is a Cross-Platform Framework.
Hope that helps!

Related

Cfbuilder Android net::err_file_not_found (file:///android_asset/www/test1.cfm)

I have written a full application that works great using chrome http://localhost:8600//
When i build to phone gap i got the error
Android net::err_file_not_found (file:///android_asset/www/xxxxxx.cfm
So i thought oh dam, what stuff did i mess up. This is my 1st App.
So i thought lets go back to basic.
So i created a new project.
I only created 2 pages index.cfm and test1.cfm
index.cfm
<html>
<head>
</head>
test
</html>
test1.cfm
<html>
<head>
</head>
index
</html>
Then i built the app.
downloaded APK
installed on samsung note 3 aswell as samsung note 10.1
When i run the app. i see the hyperlink i click(touch) on test 1.
I then get the following error then app closes
Cfbuilder Android net::err_file_not_found (file:///android_asset/www/test1.cfm)
So what do i need to do from index.cfm to load other pages once built to android.
IAm I missing tags, java. something.
there is not more "back to basic" than i can get here
Any help would be great. Have a great eveing
OK i have it figured out after a lot of testing.
Any page that want to link to another page requires the following on it
<cfclientsettings detectdevice="true" enabledeviceapi="true"/>
<cfclient>
<cfscript>
</cfscript>
</cfclient>
So my pages now look like this
index.cfm
<!doctype html>
<cfclientsettings detectdevice="true" enabledeviceapi="true"/>
<cfclient>
<cfscript>
</cfscript>
</cfclient>
<html>
<head>
</head>
test 1
</html>
test1.cfm
<!doctype html>
<cfclientsettings detectdevice="true" enabledeviceapi="true"/>
<cfclient>
<cfscript>
</cfscript>
</cfclient>
<html>
<head>
</head>
index
<br><br>
test3
</html>
I really hope this helps someone else.
have a great Day

SL4A-Python: webViewShow displays simple HTML page, that doesn't disappear after script termination

I didn't seem to find any related answers, SL4A version is R6, Py4A is R5. It's really simple, the app calls webViewShow with a HTML page, it displays properly, the script terminates, but the page does not want to disappear. Can't reach menu, back button doesn't work, only home button, then you need to kill sl4a from app manager if script is running through adb, or kill the script if run from the on-device interpreter. I also tried with http://www.google.com, same happening. The webViewShow returns a NoneType, but still, the page is displayed.
Example:
import android
droid = android.Android()
droid.webViewShow('/sdcard/sl4a/scripts/main_view.html'
HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" id="viewport"
content="width=device-width, target-densitydpi=device-dpi,
initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
</head>
<body >
<h1 style="text-align:center">Supervisor</h1>
</body>
</html>
Thanks in advance!
Maybe this could help:
<script>
var droid = new Android();
</script>
<input type="button" value="Exit" onclick="droid.dismiss();" />
I also ran into this problem, and could not find a proper answer. In my case I suspect the script cannot fully 'terminate' until the WebView closes...catch-22. To work around it I added an explicit 'Quit' option to the phone's menu button before spawning the WebView:
# give us a way to escape from the webview
droid.addOptionsMenuItem('Quit','menu-quit',None,"ic_lock_power_off")
Not ideal (the user still has to hunt for the Quit option or know about it in advance), but seems to work taking down both the script and WebView, at least on my phone (SL4A r6, Android 2.3.7).
i agree with pedro. this is the only way to exit a webview from sl4a, confirmed by damon kolher, the last maintainer of the project before it was finally forked.
once you deployed a webview, there is no way to kill it besides from within itself using js.
<script> var droid = new Android(); </script>
Then attach this to an element.
onclick="droid.eventPost('kill', ''); droid.dismiss();
For me I use an eventPost call back to my main script via eventWait.
while True:
event = droid.eventWait().result
if event['name'] == 'kill':
pipe.send('kill')
pipe.close()
i find this to work exceptionally well as i am using bottle to serve up my webview as two seperate processes and needed a way to shutdown my script as soon as the webview was exited.

images and css not showing up in apache cordova

I'm developing an android app using cordova.
The index.html has the following:
<!DOCTYPE html>
<html>
<head>
<title>Mobile</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" media="all" href="/style.css">
...
My problems concerns the link tag. Although logcat output shows the embedhttp server serving up the style.css, the styles don't get applied to the html.
In contrast, the js files I include, seem to be working perfectly fine.
<body>
<script type="text/javascript" src="/cordova.js"></script>
<script type="text/javascript" src="/lib/jquery-2.1.0.min.js"></script>
...
Has anyone else run into this issue?
I was experiencing the same problem and I solved writing the path to the images relative to css file location and not relative to .HTML file location.
I have the following structure:
css
index.css
images
mage1.png
index.html
My css class, declared inside índex.css file, must be like this one:
body {
background: url('../images/image1.png');
}
What you have to be aware of is that cordova counts relative paths differently than your normal browser. So I would recommend not using relative paths for images but use the absolute path from the project "home". Ex:
body {
background: url('images/image1.png');
}
This worked for me as I needed to keep a functioning version for a webapp as well as for a cordova nativified app.

Problem with using FusionCharts for Android

I wanted to use FusionCharts with android 2.2 (may be on emulator).
I tried using Javascript and the HTML but did not get the expected result.
Any help??
My code is as follows :
WebView web;
/** Called when the activity is first created. */
#Override
public void on Create(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
web=(WebView)findViewById(R.id.webView1);
web.loadUrl("file:///android_asset/Fusioncharts/myChart.html");
}
}
Also my html,xml files :
<html>
<head>
<title>My First chart using FusionCharts
</title>
<script type="text/javascript" src="JavaScripts/FusionCharts.js">
</script>
</head>
<body>
<div id="chartContainer">FusionCharts will load here!
</div>
<script type="text/javascript">
<!--
var myChart = new FusionCharts("Pie2D.swf? dataURL=Data.xml","myChartId", "400", "300", "0", "1" );
myChart.setXMLUrl("Data.xml");
myChart.render("chartContainer");
// -->
</script>
</body>
</html>
and Data.xml :
The above code just displays me : FusionCharts will load here!
Thanks
Sneha
EDIT> NEW CONTENT:
You might need to enable JavaScript and plugins for the WebView:
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
http://developer.android.com/reference/android/webkit/WebView.html
What does "install Flash plugin" in WebView mean?
How to Enable Flash Plugin in Webview?
Also you might need to set proper path to the SWF and JS files. Please debug or attach code here.
OLD CONTENT:
There seems to be a JavaScript error or FusionCharts not getting loaded to do the rendering as stated by Duniyadnd.
Please check the Android debug (using adb logcat or other processes) if it traces any error.
Moreover, I did an implementation using PhoneGap which you can check-out from:
PhoneGap API to query call-logs
This is a small PhoneGap Android application which has FusionCharts to show call logs from the device. The post though showcases creation of plugin to get the calllog, you might derive the other elements which you require. Hope this might help.

Phonegap + JQuery Mobile: Android crash when I click on a link

I've a problem with Phonegap + Android + JQuery Mobile.
Android close my application when I click on a link on the index.html but I don't know why...
the console of eclipse doesn't give me any error.
My Activity:
package it.test.app;
import android.os.Bundle;
import com.phonegap.*;
public class testActivity extends DroidGap {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
Example of a link in my index.html:
Link
I also created the same app for iPhone and iPad and all works right.
Can you help me?
Thanks!!
After speding a lot of time looking for a solution i've found this bug of Android:
http://code.google.com/p/android/issues/detail?id=6593
In poor words Android doesn't like to get via ajax call an html or xml with this tags:
<meta name="viewport" content="width=device-width; initial-scale=1.0 user-scalable=0;" />
<link rel="apple-touch-icon" type="image/png" href="/pics/apple-touch-icon.png" />
and generally all the "special tags" for mobile application.
Without this tags and the "rel" attributes on links all works like a charm.
ADB

Categories

Resources