java – How to Get a Frame from the Android Studio Camera

I'm new to Android Studio and Java, and I need to create an app that scales a camera frame down to 128×128 and converts all pixels into grayscale and then to solid black and full white, and then sets the value to a 128-size Boolean array
Example: Array [128] = [false, false, true, true, false …]
I already know more or less how to do this recognition using bitmaps, but I do not know how to create a camera bitmap. Basically, I want a gap that is called 30 times per second and that contains the code that contains a camera frame bitmap format, it does not necessarily have to be 30 times a second and I think it's easier to have a grayscale image but it does not necessarily have to be grayscale. I hope you understand, obs if you can explain where the code is I guess.

the app runs on a sansung galaxy j5 prime 2 with android 8.0.0

I hope to be able to view the bitmap in an image view, just to know if the return bitmap is OK, and for the time being all the code I tested has just crashed the application.

6.0 Marshmallow – Why is the network radio of an Android phone sporadically turned off?

I have an Android phone that has a problem that I suspect is related to the hardware. Randomly, the service stops working on the phone and I've just found a way to temporarily fix the problem by dialing *#*#4636#*#* and turn the radio back on manually. This restores functionality, but only temporarily. It seems indefinite when it will work again.

I can not think of a good way to pinpoint the problem, so any insight would be helpful

Chrome uses background data, although it is not allowed in Android setups

Android Chrome eats LOTS from mobile background data on my phone. This is despite the fact that I am in Android setups NOT ALLOWED Chrome to use background data (ie Settings -> Connections -> Data Usage -> Mobile Data Usage -> Chrome -> the "Allow background data usage" check box is disabled).

The attached image shows a screenshot of data usage by Chrome. Note that between September 8th and 18th, Chrome used 1.8GB of background mobile data and 0.2GB of foreground mobile data. The Allow background data usage option has been disabled since September 8th.

My mobile: Samsung S7 SM-G930T T-Mobile with current T-Mobile Stock Android 8.0 download.

Any help would be appreciated!

A screenshot of data usage by Chrome. Note that between September 8th and 18th, Chrome used 1.8GB of background mobile data and 0.2GB of foreground mobile data. The gag

java – Why my app crashes every time I start the logcat, suggest what to do. I'm new to Android development

2019-09-21 17: 27: 28.662 678-704 / in.gntex.ecommapp D / FA: Message logging enabled at debug level
2019-09-21 17: 27: 28.668 678-678 / in.gntex.ecommapp D / Android Runtime: Shutting down the VM
2019-09-21 17: 27: 28.670 678-678 / in.gntex.ecommapp E / Android Runtime: FATAL EXCEPTION: main
Process: in.gntex.ecommapp, PID: 678
java.lang.RuntimeException: Activity ComponentInfo {in.gntex.ecommapp / in.gntex.ecommapp.SplashActivity} can not be started: android.view.InflateException: Binary XML file Line 2: Binary XML file Line 2: Error occurred Inflating the class Android
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2678)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2743)
at android.app.ActivityThread.-wrap12 (ActivityThread.java)
at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1490)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6165)
at java.lang.reflect.Method.invoke (native method)
at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:778)
Caused by: android.view.InflateException: Line 2 of the binary XML file: Line 2 of the binary XML file: Error inflating the android class
Caused by: android.view.InflateException: Binary XML file Line 2: Error inflating the android class
Trigger: java.lang.ClassNotFoundException: The class "android.view.android" was not in the path "DexPathList ((zip-file" /data/app/in.gntex.ecommapp-2/base.apk"),nativeLibraryDirectories ") found = (/ data / app / in.gntex.ecommapp-2 / lib / poor, / system / lib, / vendor / lib))
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass (ClassLoader.java:380)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
at android.view.LayoutInflater.createView (LayoutInflater.java:609)
at android.view.LayoutInflater.onCreateView (LayoutInflater.java:700)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView (PhoneLayoutInflater.java:68)
at android.view.LayoutInflater.onCreateView (LayoutInflater.java:717)
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:785)
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:727)
at android.view.LayoutInflater.inflate (LayoutInflater.java:495)
at android.view.LayoutInflater.inflate (LayoutInflater.java:426)
at android.view.LayoutInflater.inflate (LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView (AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView (AppCompatActivity.java:140)
at in.gntex.ecommapp.SplashActivity.onCreate (SplashActivity.java:14)
at android.app.Activity.performCreate (Activity.java:6687)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1140)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2631)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2743)
at android.app.ActivityThread.-wrap12 (ActivityThread.java)
at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1490)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6165)
at java.lang.reflect.Method.invoke (native method)
at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:778)

android – Does a thread in a mobile game serve the same purpose as a view model in a mobile application?

I'm trying to improve my understanding of the coding differences and similarities between mobile phones game Design and mobile app Design for Android devices with Java / Kotlin.

~~~~~~

A good design principle in mobile app design is Separation of Concerns, where the app has any number of different classes to serve different purposes. A design architecture divides these concerns into two classes, the "view model" and the "UI controller" (where the UI controller is an activity or a fragment).

The view model should contain code that contains data and makes logical decisions with these data. The UI controller is used to draw this data on the screen of the device and to receive input and operating system events.

~~~~~~

In mobile game design, I saw an Activity class, a GameView class (which implements SurfaceView), and a thread subclass. The activity instantiates the GameView class and places the GameView class in its view hierarchy setContentView(GameView(this)), This is different from what the design of mobile apps is setContentView(R.layout.layout_xml_file) is used to provide views

Bitmaps can be drawn on the surface of the GameView object. The GameView object manipulates this interface using surface-specific callback functions much as the UI controller manipulates lifecycle status using lifecycle-specific callback functions. The GameView object also handles user input, such as the UI controller.

The GameView and the UI controller obviously have the same roles.

~~~~~~

  • Does a thread in a mobile game have the same purpose as a view model in a mobile app?
  • If not, where should the data and logical decisions go? Are you going to the different bitmap classes?
  • If bitmap classes have the same function as view models, how do they make logical decisions (ie, a Mario object collects a coin object)?

Root access – How can I run chroot on Android?

I have set up my chroot environment (Alpine Linux) in / sdcard / alpine. I try to execute my chroot with the following commands:

su
chroot alpine /bin/busybox 

(busybox is the cli of Alpine)

I get the following error:

chroot: exec /bin/busybox: Permission denied.

How can I fix this?

My device specifications:

Google Pixel XL (Marlin)

Android 9.0

Rooted (obviously) with Magisk

java – NullException Android Studio if Intent is used to rate another activity

Hello, I'm new here, I'm learning how to build apps with Android Studio, everything went fine until I had to transfer the values ​​of two EditText to another screen, researched and found out how to handle Intent and named it correct TextView around with the value I need but in the same activity there is an HTTP request with Json and after I used the Intent function it issued a NullException error directly into Array Json when she tried to get the data from HTTP.

Can someone help me?

Note: When I remove intent, it takes a while, but the data is taken over into the json array.

Error: https: //imgur.com/a/af4EEyZ

MainActivity: Where do the values ​​come from?

public class MainActivity extends AppCompatActivity {

//TELA CONSULTA ANTIGO BANCO DE DADOS
TextView txtInfoLOG;
EditText tfEmail, tfCPF;
Button btn_Entrar;


public static final String EXTRA_TEXT = "com.example.abemmex.EXTRA_TEXT";
public static final String EXTRA_NUMBER = "com.example.abemmex.EXTRA_NUMBER";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);

    txtInfoLOG = (TextView) findViewById(R.id.txtInfoLOG);

    tfCPF = (EditText) findViewById(R.id.tfCPF);

    tfEmail = (EditText) findViewById(R.id.tfEmail);

    btn_Entrar = (Button) findViewById(R.id.btn_Entrar);

}

public void AbrirPgtoSegundaVia(View view) {
    EditText EMAIL = findViewById(R.id.tfEmail);
    String email = EMAIL.getText().toString();

    EditText CPF = findViewById(R.id.tfCPF);
    String cpf = CPF.getText().toString();

    Intent intent = new Intent(this, PendentesActivity.class);
    intent.putExtra(EXTRA_TEXT, email);
    intent.putExtra(EXTRA_NUMBER, cpf);
    startActivity(intent);
}

public void CadastrarAssociado(View view) {
    Intent it = new Intent(this, AssociarActivity.class);
    startActivity(it);
}

}

PendingActivity: WHERE YOU RECEIVE AND REQUIRE VALUES

public class PendingActivity extends AppCompatActivity {
TextView tvName;
TextView tvEmail;
TextView tvCPF;
TextView tvWhite;
TextView tvURL;
TextView tvValue;
TextView tvExpiration;
Button btnsee;
TextView txtInfo;
TextView testEMAIL;
TextView testCPF;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pendentes);

    Intent intent = getIntent();
    String eMail = intent.getStringExtra(MainActivity.EXTRA_TEXT);
    String cPF = intent.getStringExtra(MainActivity.EXTRA_NUMBER);


    tvNome = findViewById(R.id.tvNome);
    tvEmail = findViewById(R.id.tvEmail);
    tvCPF = findViewById(R.id.tVCPF);
    tvURL = findViewById(R.id.tvURL);
    tvValor = findViewById(R.id.tvValor);
    tvVencimento =  findViewById(R.id.tvVencimento);
    tvCobranca = findViewById(R.id.tvCobranca);
    txtInfo = findViewById(R.id.txtInfoLOG);
    btnconsultar = findViewById(R.id.btn_consultar);

    testeEMAIL = findViewById(R.id.testeEMAIL);
    testeCPF = findViewById(R.id.testeCPF);

    testeEMAIL.setText(eMail);
    testeCPF.setText(cPF);
    btnconsultar.setOnClickListener(new View.OnClickListener() {


        @Override
        public void onClick(View view) {

            try {
                StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
                StrictMode.setThreadPolicy(policy);

                OkHttpClient client = new OkHttpClient();

                HttpUrl.Builder urlBuilder = HttpUrl.parse("http://meusite.com.br/apif2b/segundavia/WSBillingSegundaViaPHP.php").newBuilder();
                urlBuilder.addQueryParameter("EMAIL", testeEMAIL.getText().toString());
                urlBuilder.addQueryParameter("CPF", testeCPF.getText().toString());

                String url = urlBuilder.build().toString();

                Request request = new Request.Builder()
                        .url(url)
                        .build();

                client.newCall(request).enqueue(new Callback() {

                    @Override
                    public void onFailure(Call call, IOException e) {

                    }

                    @Override
                    public void onResponse(Call call, final Response response) throws IOException {

                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                try {

                                    try {
                                        String data = response.body().string();

                                        JSONArray jsonArray = new JSONArray(data);
                                        JSONObject jsonObject;

                                        jsonObject = jsonArray.getJSONObject(0);
                                        tvCPF.setText(jsonObject.getString("cpf"));
                                        tvEmail.setText(jsonObject.getString("email"));
                                        tvNome.setText(jsonObject.getString("nome"));
                                        tvCobranca.setText(jsonObject.getString("numero"));
                                        tvURL.setText(jsonObject.getString("url"));
                                        tvValor.setText(jsonObject.getString("valor"));
                                        tvVencimento.setText(jsonObject.getString("vencimento"));

                                    } catch (JSONException e) {
                                        txtInfo.setText(e.getMessage());
                                    }
                                } catch (IOException e) {
                                    e.printStackTrace();
                                    txtInfo.setText(e.getMessage());
                                }

                            }
                        });
                    }
                });
            } catch (Exception e) {
                e.printStackTrace();
                txtInfo.setText(e.getMessage());
            }
        }
    });
}

}