尝试使用cordova 2.0.0并使用此代码检查互联网连接
document.addEventListener("deviceready", onDeviceReady(), false);
function onDeviceReady() {
alert("ready");
db = window.openDatabase("loginintro", "1.0", "loginintro", 1000000);
db.transaction(populateDB, errorCB, successCB);
checkConnection();
}
function checkConnection()
{ alert("connection");
network = navigator.network.connection.type;
alert("fdfd");
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.NONE] = 'No network connection';
alert('Connection type: ' + states[networkState]);
}
Run Code Online (Sandbox Code Playgroud)
但在这条线上得到错误
network = navigator.network.connection.type;
Run Code Online (Sandbox Code Playgroud)
和错误是:
04-09 15:20:23.989: E/Web Console(13329): Uncaught …Run Code Online (Sandbox Code Playgroud) 我如何使用MPAndroidChart实现这一目标?
使用版本:com.github.PhilJay:MPAndroidChart:v3.1.0-alpha
为图例和饼图边距添加代码:
private void setPieChartData() {
///sf/answers/3538604191/
pieChart.setUsePercentValues(true);
pieChart.getDescription().setEnabled(false);
pieChart.setExtraOffsets(5,5,10,5);
pieChart.setDragDecelerationFrictionCoef(0.9f);
pieChart.setDrawCenterText(false);
pieChart.setDrawHoleEnabled(false);
//pieChart.animateY(1000, Easing.EasingOption.EaseInOutCubic);
ArrayList<PieEntry> yValues = new ArrayList<>();
yValues.add(new PieEntry(34f,"Ilala"));
yValues.add(new PieEntry(56f,"Temeke"));
yValues.add(new PieEntry(66f,"Kinondoni"));
yValues.add(new PieEntry(45f,"Kigamboni"));
yValues.add(new PieEntry(45f,"Kigamboni2"));
pieChart.setDrawEntryLabels(false);
PieDataSet dataSet = new PieDataSet(yValues, "Desease Per Regions");
dataSet.setSliceSpace(0.1f);
dataSet.setDrawValues(false);
dataSet.setSelectionShift(5f);
dataSet.setColors(ColorTemplate.VORDIPLOM_COLORS);
PieData pieData = new PieData((dataSet));
pieData.setValueTextSize(10f);
pieData.setValueTextColor(Color.BLACK);
pieChart.setData(pieData);
pieChart.setDrawSliceText(false);
setLegend();
}
private void setLegend() {
Legend l = pieChart.getLegend();
l.setFormSize(10f); // set the size of the legend forms/shapes
l.setForm(Legend.LegendForm.SQUARE); // set …Run Code Online (Sandbox Code Playgroud) 使用材料设计tablayout + viewpager 材料设计tablayout一切都很完美,但如果我试图将父视图作为ScrollView,以便我的整个屏幕可以滚动一旦用户尝试看到标签片段内容作为片段包含listview所以它在小的高度变得非常低添加scrollview后,我的viewpager片段没有显示?在这种情况下如何克服?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/tabanim_maincontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/tabanim_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.TabLayout
android:id="@+id/tabanim_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/tabanim_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
我试过有没有CoOrdinator布局,但没有一个工作
android android-viewpager android-coordinatorlayout android-tablayout
使用mediaplayer代码播放audio文件,无法播放.m4a扩展音频文件
错误:
java.io.IOException:准备失败。:status = 0x1 01-01 14:54:30.399 8170-8170 / com.abc.prjnameW / System.err:位于android.media.MediaPlayer.prepare(本机方法)01-01 14:54:30.399 8170-8170 / com.abc.prjnameW / System.err:at com.abc.prjname.activities.detail.AudioDetailActivity.playAudio(AudioDetailActivity.java:477)01-01 14:54:30.399 8170- 8170 / com.abc.prjnameW / System.err:位于com.abc.prjname.activities.detail.AudioDetailActivity $ 2.onClick(AudioDetailActivity.java:192)01-01 14:54:30.399 8170-8170 / com.abc。 prjnameW / System.err:在android.view.View.performClick(View.java:4753)01-01 14:54:30.409 8170-8170 / com.abc.prjnameW / System.err:在android.view.View $ PerformClick.run(View.java:19562)01-01 14:54:30.409 8170-8170 / com.abc.prjnameW / System.err:位于android.os.Handler.handleCallback(Handler.java:733)01-01 14:54:30。409 8170-8170 / com.abc.prjnameW / System.err:位于android.os.Handler.dispatchMessage(Handler.java:95)01-01 14:54:30.409 8170-8170 / com.abc.prjnameW / System。错误:在android.os.Looper.loop(Looper.java:146)01-01 14:54:30.409 8170-8170 / com.abc.prjnameW / System.err:在android.app.ActivityThread.main(ActivityThread。 java:5635)01-01 14:54:30.409 8170-8170 / com.abc.prjnameW / System.err:at …
我想使用从数据库中提取的数据在列表视图中显示用户信息。现在我的目标是使列表视图可编辑,以便当用户单击任何列表视图时,它会像“文本框”一样响应并出现键盘(适用于移动设备)。编辑完成后,用户可以按“保存”按钮将他/她的可编辑内容保存到数据库中。我在 Adobe PhoneGap API 中使用 HTML、jQuery 和 CSS。
我正在尝试从数据库值填充文本框,我想设置文本框值readonly.当用户单击EDIT选项时,则设置所有文本框变为可编辑.我未能实现这一目标.这是我的HTML代码:
<html>
<head>
<script>
$(document).ready(function() {
$('#contentid :input').each(function() {
$(this).attr("disabled",true);
});
$('#edit').on('click',function() {
$('#contentid :input').each(function() {
$(this).attr('disabled',false);});
});
});
</script>
</head>
<body>
<div data-role="page" id="viewInformation" data-theme="d" data-add-back-btn="true" data-back-btn-text = "back">
<div data-role="header" id="headerid" class="ui-bar ui-bar-b">
<h3></h3>
</div>
<div data-role="content" id="contentid">
<a href="#" id="saveDBValue" data-role="button" data-mini="true" style="width:60px; height:40px; float:center;">SAVE</a>
<a href="#" id="edit" data-role="button">EDIT</a>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
这是我的JavaScript代码:
function getDataofSelectedListItem()
{
alert("getDataofSelectedListI");
clickedListItem = window.localStorage.getItem("clickedValueofList");
console.log("clicked list item"+clickedListItem);
//db = window.openDatabase("loginintro", "1.0", "loginintro", 1000000);
var sqlQuery = 'SELECT * FROM loginTable WHERE …Run Code Online (Sandbox Code Playgroud)