我无法将Android Wear Emulator连接到我的设备.我有HTC One设备,它有4.4(KitKat OS).
我按照以下链接:
但是,当我通过命令提示符执行行adb -d forward tcp:5601 tcp:5601时,没有任何反应.Android Wear模拟器不显示设备已连接.
注意:我可以在设备中成功启动Android Wear预览应用,并且还启用了通知设置.
任何帮助将不胜感激.
我读了Javascript Hoisting的概念.它让我感到很困惑,但是我看到了一些例子,并且知道吊装实际上是做什么的.
所以基本上" 提升是JavaScript将所有声明移动到当前范围顶部(到当前脚本或当前函数的顶部)的默认行为. "
但我无法理解以下实施:
var is_android = true;
if (is_android) {
function foo() {
alert('I am Android');
}
} else {
function foo() {
alert('I am NOT Android');
}
}
foo();
Run Code Online (Sandbox Code Playgroud)
输出在警告框中显示" 我不是Android ".
我想知道为什么foo()
从else块调用,即使is_android
值为true.
任何帮助将不胜感激.
以下是我的代码:
package com.example.videoplayer;
import android.app.Activity;
import android.app.ProgressDialog;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.MediaController;
import android.widget.VideoView;
public class VideoPlayerActivity extends Activity {
String TAG = "com.example.VideoPlayer";
ProgressDialog progDailog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_player);
final VideoView videoView = (VideoView) findViewById(R.id.videoView1);
videoView.setVideoPath("http://www.ebookfrenzy.com/android_book/movie.mp4");
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setOnPreparedListener(new
MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
progDailog.dismiss();
Log.i(TAG, "Duration = " + videoView.getDuration());
}
});
videoView.start();
progDailog = ProgressDialog.show(this, "Please wait ...", "Retrieving data …
Run Code Online (Sandbox Code Playgroud) 我知道在SO中多次询问这个问题.我已检查下面贴出的答案,但对我不起作用:(
目前,我的应用程序的包名是" com.example.test ".我想将其更改为" com.example.test.test1 ".所以,我只是更改了清单文件中的包名并构建了应用程序.
现在,如果我单独运行两个应用程序,上面的包名称从清单文件更改为设备,它应该向我显示不同的应用程序.它显示错误为" 失败[INSTALL_FAILED_CONFLICTING_PROVIDER] "
由于软件包名称不同,它应该向我显示设备中的不同应用程序,而不是覆盖一个应用程序与其他应用程序.帮助我.
任何帮助将不胜感激.谢谢
我使用Eclipse来实现android应用程序,工作空间是空的.我找不到任何项目,如果我尝试加载一个项目,则会将错误显示为无效描述.我的所有项目都在适当的工作空间位置,但仍然为什么我看不到它们?
我使用webview显示本地html内容,其中包含android 4.2和4.3上的视频.
并且调用" webview.onPause()
"方法以防止在活动不可见时视频仍然播放.
当活动到达前台时,在调用" webview.onResume()
"方法后视频不会恢复.
活动到达前台后如何恢复视频?
谢谢.
我想在不使用活动和片段活动的情况下在两个片段之间传递数据.
我不想使用以下活动在片段之间传递数据:与其他片段进行通信
以下是我的情景:
我有一个Parent片段,里面有两个子片段.现在我需要在这两个片段之间传递数据.如何实现这一点?
我调查了这个: 事件总线,但没有得到碎片的工作示例.
在片段之间传递数据还有其他选择吗?
任何帮助将不胜感激.
根据InnocentKiller的回答编辑:
在FragmentOne中,我实现了:
FragmentTwo = new FragmentTwo();
Bundle bundle = new Bundle();
bundle.putString("Hello", "My name is Siddharth");
fragment.setArguments(bundle);
Run Code Online (Sandbox Code Playgroud)
在FragmentTwo中,我实现了:
Bundle bundle = this.getArguments();
String myInt = bundle.getString("Hello","Test");
mStartTripButton.setText(myInt);
Run Code Online (Sandbox Code Playgroud) android android-fragments android-activity android-fragmentactivity
我面临在 Titanium Android 中格式化简单文本字段的问题。
问题:我无法查看我输入的文本字段输入值。如果我打印日志,它会进入但不可见。在某些设备中,我得到了截断的文本。
下面是我的代码:
在我的 .js 文件中,我有如下文本字段:
var t1 = Titanium.UI.createTextField({
value : Titanium.App.Properties.getString("userID"),
left : 130,
top : 25,
height : 30,
width : 140,
color : 'black',
font : {
fontSize : 12
},
borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
Run Code Online (Sandbox Code Playgroud)
在我的 tiapp.xml 文件中:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application android:theme="@style/Theme.Titanium"/>
<supports-screens android:anyDensity="false"
android:largeScreens="false"
android:normalScreens="false" android:resizeable="false"
android:smallScreens="false" android:xlargeScreens="false"/>
</manifest>
</android>
Run Code Online (Sandbox Code Playgroud)
尝试的解决方案:我尝试了链接中提供的解决方案:
它说您需要将 TextField 的高度设置为“ Ti.UI.SIZE ” +<supports-screens android:anyDensity="true"/>
在 tiapp.xml 文件中添加+在 tiapp.xml 文件中添加 …
formatting android textfield titanium-mobile titanium-android
我正试图从画廊中选择照片DialogFragment
.但是我nullpointerexception
在初始化的过程中得到了cursor
.任何想法为什么会出现此错误?
以下是我的代码:
if (resultCode == Activity.RESULT_OK) {
Uri selectedImage = imageReturnedIntent.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
// Nullpointerexcepiton on this line
Cursor cursor = getActivity().getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
cursor.close();
}
Run Code Online (Sandbox Code Playgroud)
这是我的logcat错误:
03-24 12:34:37.645: E/AndroidRuntime(21479): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65538, result=-1, data=Intent { dat=content://media/external/images/media/3890 flg=0x1 }} to activity {com.example/com.example.MainActivity}: java.lang.NullPointerException
03-24 12:34:37.645: E/AndroidRuntime(21479): at android.app.ActivityThread.deliverResults(ActivityThread.java:3462)
03-24 12:34:37.645: E/AndroidRuntime(21479): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3505)
03-24 12:34:37.645: E/AndroidRuntime(21479): at android.app.ActivityThread.access$1100(ActivityThread.java:150)
03-24 12:34:37.645: E/AndroidRuntime(21479): at …
Run Code Online (Sandbox Code Playgroud) 需要了解寄生继承实际上是做什么的。
我提到了这个链接:javascript中的寄生继承
我需要了解这个例子的作用:
Shape = {name: 'Shape'};
Shape.prototype.toString = function()
{
return this.name;
};
function Rectangle(width, height) {
var rect;
P = function() {};
P.prototype = Shape;
rect = new P();
rect.width = width;
rect.height = height;
return rect;
}
Run Code Online (Sandbox Code Playgroud)
第二个示例工作正常,但我需要知道“寄生继承从何而来? ”
var Person = function(name, age)
{
this.name = name;
this.age = age;
};
var Employee = function(name, age, group)
{
var e = new Person(name, age);
e.group = group;
return e;
};
var testname= new Employee('ABC', …
Run Code Online (Sandbox Code Playgroud) 如何通过adb shell命令从android设备中提取应用程序的数据库?
谢谢
android ×9
javascript ×2
adb ×1
cursor ×1
database ×1
eclipse ×1
formatting ×1
function ×1
hoisting ×1
inheritance ×1
textfield ×1
wear-os ×1
webview ×1