在android中存储图像的最佳方法是什么?
也可以从android中的Web服务调用访问jsp页面,如何做到这一点?
谢谢,
Sneha
我有我的android活动:
try {
File root=Environment.getExternalStorageDirectory();
Log.i("root",root.toString());
File dir=new File(root.getAbsolutePath() + "/downloads");
dir.mkdirs();
file=new File(dir,"mytext.txt");
FileOutputStream out=new FileOutputStream(file,true);
PrintWriter pw=new PrintWriter(out);
pw.println("Hello! Welcome");
pw.println("You are Here...!!!");
pw.flush();
pw.close();
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
还补充说:
<uses-permission android:name="androd.permission.WRITE_EXTERNAL_STORAGE"/>
Run Code Online (Sandbox Code Playgroud)
但它抛出我FileNotfound异常:01-13 09:06:44.442:WARN/System.err(419):java.io.FileNotFoundException:/mnt/sdcard/downloads/mytext.txt(没有这样的文件或目录)
如果我加
if(file.exists()){
System.out.println("file exists");
}
else{
System.out.println("No such Fileeeeeeeeee");
}
Run Code Online (Sandbox Code Playgroud)
它进入"其他"部分.
谢谢
Sneha
我收到以下异常,无法调试它.
请帮忙.
码:
public class HybridActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView webview=(WebView)findViewById(R.id.webkitWebView1);
WebSettings settings=webview.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDatabaseEnabled(true);
settings.setDomStorageEnabled(true);
settings.setAllowFileAccess(true);
settings.setBuiltInZoomControls(true);
webview.setWebChromeClient(new WebChromeClient());
// webview.loadUrl("file:///android_asset/www/html/hyb.html");
// webview.loadUrl("file:///android_asset/index.html");
try {
webview.loadUrl("http://www.google.com");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MultipleWebViewHanlder webView2 = new MultipleWebViewHanlder(this);
webView2.loadNewWebView();
}
}
public class MultipleWebViewHanlder {
public MultipleWebViewHanlder(Context context) {
// TODO Auto-generated constructor stub
this.context = context; …Run Code Online (Sandbox Code Playgroud) 我只想将样式仅应用于 myPage id。但我无法通过以下方式实现它:
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="style1.css"/>
</head>
<body>
<div>
Welcome To CSS3....
Learning.....!
</div>
<div id="myPage">
Welcome ....
<img src="rose1.jpg" width="200" height="200" />
</div>
</body>
</html>
.myPage div{
border:2px solid black;
background-color:yellow;
font-color:red;
box-shadow:10px 10px 7px #777
}
Run Code Online (Sandbox Code Playgroud)
请告诉我错在哪里。
谢谢
斯内哈
我有以下app.js,它无法使用模块调用应用程序.附加文件夹结构和代码的截图:
core.module.js:
(function() {
'use strict';
angular
.module('app.core');
})();Run Code Online (Sandbox Code Playgroud)
(function () {
'use strict';
angular
.module('app', [
'ngRoute',
'ngCookies',
'ngAnimate',
'ngResource',
'ngCookies',
'ngTouch',
'app.core',
'app.events'
])
.config(config);
config.$inject = ['$routeProvider', '$locationProvider', '$httpProvider'];
function config($routeProvider, $locationProvider, $httpProvider) {
$routeProvider
.when('/', {..}..Run Code Online (Sandbox Code Playgroud)
Uncaught Error: [$injector:nomod] Module 'app.core' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.Run Code Online (Sandbox Code Playgroud)
我有以下 CSS 转换 -
fadeinout-animate {
width:200px;
height: 200px;
background: red;
-webkit-animation: fadeinout 4s linear forwards;
animation: fadeinout 4s linear forwards;
opacity: 0;
}
@-webkit-keyframes fadeinout {
50% { opacity: 1; }
}
@keyframes fadeinout {
50% { opacity: 1; }
}
@keyframes fadeinout {
100% { opacity: 0;display:none; }
}Run Code Online (Sandbox Code Playgroud)
但是,当我将此类添加到 Angular 模板中的 div 时,显示没有任何效果,但 200*200 的空白区域保持原样。(如果我检查元素,我仍然看到单独的红色背景消失了,但在浏览器中手动应用显示无内联样式会隐藏或删除 div)如果我设置 height:0 该 div 会消失,但会影响行为。我如何解决它?
我想捕获一个音频并将其转换为字节数组.
但是当我录制音频时,会加入噪音.
android中是否有任何过滤库,以便我可以删除其中的噪音.
此致,
Sneha
我有以下程序,但错误地显示月份.请帮忙.
date1="31/12/2011";
SimpleDateFormat formatter = new SimpleDateFormat("dd/mm/yyyy");
try {
d1 = (Date)formatter.parse(date1);
System.out.println("dateeeeeeeeeeeeeeee " + date1);
tdy1=Calendar.getInstance();
System.out.println("tdy mnthhhhhhhhhhh " + tdy1.get(Calendar.MONTH));
tdy1.setTime(d1);
System.out.println("Month of date1= " + tdy1.get(Calendar.MONTH));
//catch exception
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
并且输出的是:
date of date1 = 0 Wat可能是问题?
有什么办法可以像我们在这里提到的那样对原始文件夹中的文件进行读取/解析android清单文件:
http://eagle.phys.utk.edu/guidry/android/writeSD.html
getResources.ReadManifest ..类似的东西?
谢谢
Sneha
我有以下HTML代码:`
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("div").animate({
backgroundColor: '#f5f5f5',
});
});
});
</script>
</head>
<body>
<button>Start Animation</button>
<p>By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p>
<div style="background:#98bf21;height:100px;width:100px;position:absolute;">
</div>
</body>
</html>`
Run Code Online (Sandbox Code Playgroud)
但我无法使用动画提到的背景颜色.
请告诉我有什么问题?
谢谢
Smitha
以下代码未显示弹出时间戳.知道怎么解决?
码:
<ul class="dropdown-menu custom-scroll dropDownLabel custom-width" role="menu" aria-labelledby="btn-append-to-body"
ng-show="!sr.timedisplay"
>
<li role="menuitem">
<a href="" ng-click="$event.stopPropagation()">Start Time
<p class="input-group">
<input type="text" class="form-control" timepicker-popup ng-model="sr.startTime" is-open="opened" timepicker-options="timeOptions" ng-required="true"/>
<span class="input-group-btn">
<button class="btn btn-default" ng-click="sr.getTime('startTime')"><i class="glyphicon glyphicon-time"></i></button>
</span>
</p>
</a>
</li></ul>Run Code Online (Sandbox Code Playgroud)
timepicker angularjs angular-ui angular-ui-bootstrap angular-ui-bootstrap-tab
尝试在Opera 12浏览器上运行html5文件时出现以下错误:
-webkit-transition是一个未知属性
-webkit-transition:opacity 0.5s ease-in-out 0s;
----------------------- ^ Linked-in stylesheet mycsspage.css:21
怎么解决这个?
谢谢
Sneha
我有以下角度代码:
'use strict';
/**
* @ngdoc service
* @name .cordova
* @description
* # cordova
* Factory in the APP.
*/
angular.module('app')
.factory('cordova', function () {
// Service logic
// ...
var d = $q.defer(),
resolved = false;
var self = this;
this.ready = d.promise;
document.addEventListener('deviceready', function () {
resolved = true;
d.resolve($window.cordova);
});
// Check to make sure we didn't miss the
// event (just in case)
setTimeout(function () {
if (!resolved) {
if ($window.cordova) d.resolve($window.cordova);
}
}, 3000); …Run Code Online (Sandbox Code Playgroud)