小编Roh*_*5k2的帖子

仿真器:仿真器:错误:x86仿真当前需要硬件加速!模拟器:进程以退出代码1完成

Emulator: emulator: ERROR: x86 emulation currently requires hardware acceleration! Emulator: Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

android

26
推荐指数
3
解决办法
6万
查看次数

Android系统.如何在Surface上播放视频(OpenGL)

需要帮助

  1. 如何Surface(OpenGL)在Android中播放视频?我试着在播放视频mySurfaceView extends SurfaceView的帮助方法setSurface()MediaPlayer.

    SurfaceTexture mTexture = new SurfaceTexture(texture_id);
    Surface mSurface = new Surface(mTexture);
    MediaPlayer mp = new MediaPlayer();
    mp.setSurface(mSurface);
    
    Run Code Online (Sandbox Code Playgroud)

我只播放音频 - 不播放视频.

  1. 如何获取视频缓冲区OpenGL
  2. 如何播放视频GLTexture

video android opengl-es

18
推荐指数
2
解决办法
2万
查看次数

为什么不能在上限泛型列表中添加元素?

我有一个带有上限泛型的列表.

 List<? extends Number> l = new ArrayList<>();
 l.add(new Integer(3));  //ERROR
 l.add(new Double(3.3)); // ERROR
Run Code Online (Sandbox Code Playgroud)

我不明白这个问题,因为Integer和Double扩展了Number.

java

14
推荐指数
4
解决办法
2533
查看次数

使用Parse api时返回的KnoxVpnUidStorageknoxVpnSupported API值为false错误

嗨,我刚刚在android中尝试使用parse Api.并在logcat中获得以下错误.

这是我的代码:

 ParseQuery<User> query = ParseQuery.getQuery("User");
            query.whereEqualTo("phone", phone);

            try {
                List<User> all = query.find();
                Log.v("Size of users are",all.size()+"");
                if (all.size() != 0) {
                    foundUser = true;
                    a = all.get(0);
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
Run Code Online (Sandbox Code Playgroud)

这是我的logcat中的错误:

KnoxVpnUidStorageknoxVpnSupported API value returned is false
com.parse.ParseRequest$ParseRequestException: i/o failure
02-11 17:11:57.871 16766-17225/com.parse.starter W/System.err:     at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:372)
02-11 17:11:57.871 16766-17225/com.parse.starter W/System.err:     at com.parse.ParseRequest$2.then(ParseRequest.java:198)
02-11 17:11:57.871 16766-17225/com.parse.starter W/System.err:     at com.parse.ParseRequest$2.then(ParseRequest.java:190)
02-11 17:11:57.871 16766-17225/com.parse.starter W/System.err:     at bolts.Task$14.run(Task.java:796)
02-11 17:11:57.871 16766-17225/com.parse.starter W/System.err: …
Run Code Online (Sandbox Code Playgroud)

android parse-platform

8
推荐指数
0
解决办法
3314
查看次数

应用程序崩溃 java.net.SocketTimeoutException: timeout (Kotlin, Retrofit)

如果没有响应,应用程序会在这条线上崩溃。

chain.proceed(requestBuilder.build())
Run Code Online (Sandbox Code Playgroud)

这是我的 RetrofitClient 课程

class RetrofitClient {

    private val apiService: ApiServiceInterface

    init {
        val builder = Retrofit.Builder()
        builder.baseUrl(RequestParameters.BASE_URL)
        builder.addConverterFactory(GsonConverterFactory.create())
        builder.addCallAdapterFactory(RxJava2CallAdapterFactory.create())//added for adapter
        builder.client(getClient())
        val retrofit = builder.build()
        apiService = retrofit.create(ApiServiceInterface::class.java)
    }

    companion object {
        private var clientInstance: RetrofitClient? = null
        lateinit var context: Context

        fun getInstance(): RetrofitClient {
            if (clientInstance == null) {
                clientInstance = RetrofitClient()
            }
            return clientInstance as RetrofitClient
        }
    }

    fun getApiInterface(): ApiServiceInterface {
        return apiService
    }

    private fun getClient(): OkHttpClient {

        val httpClient = OkHttpClient.Builder() …
Run Code Online (Sandbox Code Playgroud)

android httpclient kotlin rx-java retrofit2

8
推荐指数
1
解决办法
3407
查看次数

java.lang.IllegalStateException Butterknife

我正面临,java.lang.IllegalStateException Required view 'splash_text'但我已将其包含在xml中.

Butterknife用来绑定观点.

 compile 'com.jakewharton:butterknife:7.0.1'
Run Code Online (Sandbox Code Playgroud)

Xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_orange_light">

<com.CustomTextView
    android:id="@+id/splash_text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
   />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

活动:

@Bind(R.id.splash_text)
CustomTextView mSplashTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_splash);
    ButterKnife.bind(this);

    mSplashTv.setText("Splash");

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            finishSplash();
        }
    },3000);
}
Run Code Online (Sandbox Code Playgroud)

应用程序崩溃了 mSplashTv.setText("Splash");

记录:

  Caused by: java.lang.IllegalStateException: Required view 'splash_text' with ID 2131492944 for field 'mSplashTv' was not found. If this view is optional add '@Nullable' annotation. …
Run Code Online (Sandbox Code Playgroud)

android android-activity butterknife

7
推荐指数
1
解决办法
7325
查看次数

DownloadManager 下载已完成但文件未存储

我遇到了奇怪的问题DownloadManager,下载成功但文件未存储。

这是我的代码:

try {
    DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
    DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
    request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE);
    request.setAllowedOverRoaming(false);
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
    request.setDestinationInExternalFilesDir(context, /temp/, "test.mp4");
    final long downloadId = manager.enqueue(request);
    boolean downloading = true;
    while (downloading) {
        DownloadManager.Query query = new DownloadManager.Query();
        query.setFilterById(downloadId);
        Cursor cursor = manager.query(query);
        cursor.moveToFirst();
        int status = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS));
        int bytesDownloaded = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
        int bytesTotal = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
        if(status==DownloadManager.STATUS_SUCCESSFUL){
            Log.i("Progress", "success");
            downloading = false;
        }
        final int progress = (int) ((bytesDownloaded * 100l) / bytesTotal);
        cursor.close();
        subscriber.onNext(progress);
    }
    subscriber.onCompleted(); …
Run Code Online (Sandbox Code Playgroud)

android download-manager android-download-manager

6
推荐指数
1
解决办法
4296
查看次数

Android片段必须是静态的

我有这个错误,但我不知道如何解决这个错误.

错误:片段应该是静态的,以便系统可以重新实例化,而匿名类不是静态的[ValidFragment]

如果您知道如何解决,请帮助我

这是MainActivity.java

import android.annotation.TargetApi;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;


import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;

import org.json.JSONArray; …
Run Code Online (Sandbox Code Playgroud)

java android fragment android-fragments

5
推荐指数
1
解决办法
5096
查看次数

使用 Retrofit 调用 Kotlin API

我对 Kotlin、Android 和 OOP 都很陌生(自然-ADABAS 背景,从未接触过 Java、C++ 等),所以我非常绝望。

我有一个 API,其数据如下所示,是一组书籍详细信息:

API数据样本

在此输入图像描述

我对数据模型感到困惑。我知道它应该看起来像 API 中的数据并返回一个数组,但是我到底如何在 Kotlin 中对其进行编码呢?然后我该如何解析它?我读过一些教程,但它们都有所不同。有些使用对象,有些使用类。

我也可能通过将所有内容都放在主要活动中来打破一些标准,但我还没有到达那部分。

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import retrofit2.http.GET
import retrofit2.http.Query

class MainActivity : AppCompatActivity()

 {

private val api: RestAPI = RestAPI()

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)


    val apiGetBooks = api.getBooksList("token123123123")
    val response = apiGetBooks.execute()


    if (response.isSuccessful) {
        val books = response.body()?.title
        println(books)

    } else {
        println("error on API") // What do I do?
    }

}

object  Model …
Run Code Online (Sandbox Code Playgroud)

api android kotlin retrofit2

5
推荐指数
1
解决办法
1万
查看次数

Android studio 像素化预览

将 Android Studio 更新到 3.1.2 版后,出现了预览图像所在的问题,像素化/模糊。谁能帮我解决这个问题?

这是图像的渲染方式

在此处输入图片说明

xml android preview android-studio

5
推荐指数
2
解决办法
1273
查看次数