我是Android SDK/API环境的新手.这是我第一次尝试绘制情节/图表.我尝试使用3个不同的免费库运行不同类型的示例代码模拟器,在布局屏幕中没有显示任何内容.logcat重复以下消息:
W/Trace(1378): Unexpected value from nativeGetEnabledTags: 0 I/Choreographer(1378): Skipped 55 frames! The application may be doing too much work on its main thread.
当我运行与许可库的评估副本有关的示例代码时,问题不会持续存在并且图表有效.
所以我已经阅读了Romain Guy 关于设置Window背景和深刻表现的博客文章,并试图模仿它.这是一个简单的解决方案,并不确定为什么我不能让这个工作,但活动只是拒绝接收定向背景.
我有一个ListView,onListItemClick启动一个新的Activity,需要3-5秒才能完全加载.当用户在等待时,我想绘制一个windowBackground,以便他们在实际准备好之前"看到"该活动.这是我的代码:
针对已启动活动的AndroidManifest代码段:
<activity
android:name=".activity.EditorActivity"
android:screenOrientation="portrait"
android:windowBackground="@drawable/background_editor">
Run Code Online (Sandbox Code Playgroud)
EditorActivity的XML布局:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/editor"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="Editor" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
最后,drawife在Manifest中设置,background_editor.xml:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/editor_bg"
android:tileMode="repeat" />
Run Code Online (Sandbox Code Playgroud)
editor_bg是一个位于drawable文件夹中的.png文件.
最终结果是EditorActivity被启动,我看到的是默认的黑色背景,其中"Editor"文本显示为白色(我添加了以测试XML文件是否正确加载).
我也尝试通过android:background ="@ android:color/transparent"将FrameLayout和TextView的背景设置为透明,想想也许他们默认为黑色背景,但没有运气.
已经很长一段时间了,我确信我错过了一些简单的事情...我在这里犯的任何明显的错误?
我在Android中制作媒体播放器.我需要一个代码才能在不使用视频的情况下获取视频长度.
我在Stack溢出中看到很多页面但是用过的页面用于显示如何在视频视图中获取视频的长度,但我需要没有视频视图.
我对onItemLongClick(...)的第3和第4个参数感到困惑.根据AdapterView.OnItemLongClickListener
position - 列表中视图的位置
id - 单击的项的行ID
我不能从这些中得到任何意义,请指教.
我的应用程序用于安全目的.因此,从我的应用程序用户捕获照片,所有照片都存储在文件夹中,该文件夹不应从任何其他应用程序访问,并且在设备连接到计算机系统时不应提供访问权限.如果用户想要查看这些图像,则只能从我的应用程序访问.
今天,我将android studio 1.3.2(build 141.2178183)更新为1.4.0(build 141.2288178).
单击" 更新并重新启动"按钮后,它下载了修补程序文件.
但是在安装文件时出错了.
在安装区域发现了一些冲突.
下面的一些冲突没有解决方案,因此无法应用补丁.
重新安装将解决这个问题,因为这是我第二次遇到这种情况,但这不是一个好的解决方案.
我也google了很多,但没有人能解决它.
我需要(如果可能的话)在用户输入拨号器中的#1234#等代码时为我的项目添加一项功能.我不确定这是可能的.目前,当我从应用程序文件夹中为我的应用程序共进午餐时,它启动但只是为了好玩,我想知道我可以用代码午餐吗?
我想问一下UIL从InputStream输入的URI.因为我的图像来自ZIP,然后我必须提取它来显示该图像.因为图像太大,我必须使用UIL库,任何人都知道如何从InputStream插入UIL.
我正试图在我的手机上运行一个简单的代码(Genymotion不起作用,所以我必须直接在我的手机上运行它)它告诉我"外部任务执行完成"但是选择设备框没有弹出当我按"运行".我安装了:
此外,Android设备监视器正在显示我的设备,因此识别我的手机没有问题.
在项目上工作时,我在跟随活动时收到错误消息。1.以下代码行中的Login.java。
行:“字符串用户名= user.getText()。toString();” 错误:“必须从UI线程调用方法getText(),当前推断的线程是worker。”
这是我的整个活动代码。
package com.example.mysqltest;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class Login extends Activity implements OnClickListener {
private EditText user, pass;
private Button mSubmit, mRegister;
// Progress Dialog
private ProgressDialog pDialog;
// JSON parser class
JSONParser jsonParser = new JSONParser();
//php login script location:
//localhost :
//testing on …Run Code Online (Sandbox Code Playgroud) 我想使用volley库在android中获取JSONObject的值.
这是我的MainActvity.java代码.
String url = "http://someexample.com/signin.php";
StringRequest postRequest = new StringRequest(Request.Method.POST, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonResponse = new JSONObject(response).getJSONObject("type");
String myObjAsString = jsonResponse.toString();
mTV.setText(myObjAsString.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
}
) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<>();
// the POST parameters:
params.put("email", "example@outlook.com");
params.put("password", "********");
return params;
}
}; …Run Code Online (Sandbox Code Playgroud) 我已经使用了以下代码,但它在执行Asyntask时出错,而且我已经发布了我的JsonParser类.请指导我如何删除此错误.
public class Login extends Activity implements OnClickListener {
private EditText user, pass;
private Button mSubmit, mRegister;
private ProgressDialog pDialog;
// JSON parser class
JSONParser jsonParser = new JSONParser();
private static final String LOGIN_URL = "http://******/web_service/index.php";
//www.itsoft-solutions.net
//JSON element ids from repsonse of php script:
private static final String TAG_SUCCESS = "success";
private static final String TAG_MESSAGE = "message";
public static String uname;
public static String password;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.login); …Run Code Online (Sandbox Code Playgroud)