Google Data Studio – displaying a chart based on pivot table, without showing the pivot table?

My raw data is in Google Sheets, with one of the columns representing categories that should act as filter. As a tryout, we’ve created pivot tables in Sheets, and charts on those pivot tables.

Now I’ve got to recreate those charts as a Data Studio report.

Looked at some basic tutorials, but I’m probably missing something crucial:

  • If I use the pivot table data from Sheets as data source, then I can’t apply a filter on the categories (they are in the pivot tables).

  • If I create a pivot table in Data Studio on the raw data, I couldn’t find an option to (1) not show this pivot table and (2) use this pivot table as input for a chart.

Any help is appreciated.

ui automation – Katalon Studio : Stale Element Exception while handling a web drop down

I am automating a use case using katalon studio and in the process, I need to write my automation to select an option from a dropdown. when I execute my automation script I see that option is getting select properly on the UI but in the console, I see an exception as below
“Caused by: org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document”

I tried adding some wait time before the action is taken but it did not work. Is there anything I can do to resolve this apart from handling the exception explicitly.

please do let me know if I can provide additional information for this issue.

Thanks.

Is it possible to assign a color to specific comments strings in Visual Studio Code

I’m looking for an existing solution (probably using an extension) for marking some specific strings in my code with a fixed color (defined by me in some configuration file) on Visual Studio Code.

E.g. Instead of showing the whole comment in green //The comment here is awesome, I would like to mark the word “here” with a red color text or red color background.

I’ve noticed VSCode have done it for the word TODO: (marked with orange background and white text color), I would like to define more strings like this.

Thanks 🙂

java – Como concatenar uma String invocada de um arquivo xml com uma variável float no Android Studio?

Boa noite, pessoal. Estou tentando concatenar uma String que guardei num arquivo xml (strings.xml) com uma variável float da seguinte maneira gas.setText(String.format("%s %s", R.string.gasoline_mod, value));
Porém, ao testar a aplicação, ao invés de aparecer a String guardada no xml, aparece um numero inteiro de 11 dígitos, seguido da variável float que, ao que parece, foi corretamente invocada.
Existe alguma outra forma de invocar a String ou estou errando a sintaxe?

E/AndroidRuntime: FATAL EXCEPTION: Thread-8 – Al utilizar función geocoder GoogleMaps Android Studio

Estoy experimentando desarrollar una aplicación con mapa soy nuevo aún en el desarrollo de aplicaciones móviles. Estoy haciendo una llamada asíncrona a la función geocoder de la API de google maps implementando un nuevo hilo para que no pueda intervenir en el hilo principal de la siguiente manera:

private fun onMapReady(){
  requestPermissions(arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), 1)


        locationManager = this.requireContext().getSystemService(LOCATION_SERVICE) as LocationManager

        if (ActivityCompat.checkSelfPermission(
                this.requireContext(),
                Manifest.permission.ACCESS_FINE_LOCATION
            ) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
                this.requireContext(),
                Manifest.permission.ACCESS_COARSE_LOCATION
            ) != PackageManager.PERMISSION_GRANTED
        ) {
            ActivityCompat.requestPermissions(
                this.requireContext() as Activity,
                arrayOf(
                    Manifest.permission.ACCESS_FINE_LOCATION,
                    Manifest.permission.ACCESS_COARSE_LOCATION
                ),
                101
            )
            return
        }
        mMap.isMyLocationEnabled = true
        mMap.uiSettings.isMyLocationButtonEnabled = false

        locationManager.requestLocationUpdates(NETWORK_PROVIDER, 1000L, 0.0f, object : LocationListener{
            override fun onLocationChanged(location: Location?) {

            }

            override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {

            }

            override fun onProviderEnabled(provider: String?) {

            }

            override fun onProviderDisabled(provider: String?) {

            }

        })

        geocoder = Geocoder(context, Locale.getDefault())

        mMap.setOnCameraIdleListener{
            val centerMap = mMap.cameraPosition.target
            hilosDirection(centerMap) //Buscamos la dirección con el hilo
        }

        mMap.setOnCameraMoveListener {
            originDirection.text = "Actualizando ubicación..."
        }

    }

El hilo donde implemento la función geocoder de google maps lo implemente de ésta forma:

fun hilosDirection(centerMap: LatLng){
        Thread(object : Runnable{
            override fun run() {
                try {
                    address = geocoder.getFromLocation(centerMap.latitude, centerMap.longitude, 1) as List<Address>

                        val originAddress = (address(0).getAddressLine(0)).split(",") //ÉSTA ES LA LINEA EN DONDE ME ENVÍA EL ERROR "HomeFragment.kt:442"
                        activity!!.runOnUiThread(object : Runnable{
                            override fun run() {
                                originDirection.text = originAddress(0)
                            }
                        })

                }catch (e:IOException){
                    e.printStackTrace()
                }
            }
        }).start()
    }

Cuando lo ejecuto en un dispotivo Xiaomi con normalidad me mustra el marcador azul de mi ubicación. El error que me envía me pasa cuando estoy probando en un dispositivos con Android 7 como por ejemplo un Alcatel y un Azumi.

La verdad no se porqué me envía éste error:

2020-06-27 19:46:46.760 12640-12840/com.example.myapplication E/AndroidRuntime: FATAL EXCEPTION: Thread-8
    Process: com.example.myapplication, PID: 12640
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.get(ArrayList.java:411)
        at com.example.myapplication.ui.home.HomeFragment$hilosDirection$1.run(HomeFragment.kt:442)
        at java.lang.Thread.run(Thread.java:761)

Si alguien podría guiarme o quizá esté implementando mal el hilo o tenga algun problema con la función geocoder le agradecería de antemano

Android Studio 4.0 unable to locate adb desde que se actualizó

Actualice Android Studio a la versión 4.0 y no puedo simular mi proyecto de flutter, apareciendo el mensaje “unable to locate adb”.

Revisé y todo parece estar en orden

Pueden ver en la imagen que tengo instalado SDK Tools y Command-Line tools porque flutter doctor me dio problemas con este
introducir la descripción de la imagen aquí

El adb esta en la carpeta y la dirección la tengo en el antivirus para evitar falsos positivos
introducir la descripción de la imagen aquí

Que falta?

android studio – Listview With Custom Adapter, Checkbox Items And Select All option

I have an application that populate data from sqlite and put in a listview

1 of the holder in listview layout is a checkbox.

I also have 1 checkbox in the forupload activity which named select all, that if all the items in the listview are checked, the select all checkbox will be set as checked. And if I check the select all checkbox, all the items in the listview will be checked

ForUploadActivity.xml

<CheckBox
            android:id="@+id/chckbox_selectall_forUpload"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="SELECT ALL"
            android:textStyle="bold"
            android:textAlignment="center"
            android:textSize="20sp"
            android:button="@null"
            android:drawableRight="?android:attr/listChoiceIndicatorMultiple"
            android:drawableEnd="?android:attr/listChoiceIndicatorMultiple"
            tools:ignore="HardcodedText" />

        <ListView
            android:id="@+id/listview_forUpload"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center" />

**ListviewLayout.xml**
<TextView
    android:id="@+id/holder_name_forUpload"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textColor="@android:color/black"
    android:textStyle="bold" />

<TextView
    android:id="@+id/holder_address_forUpload"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textColor="@android:color/black"
    android:textStyle="bold" />


**ForUploadActivity**

ListView New_forUpload_List;
private Button Upload_Selected_Items, Delete_All;
com.vicjames.irca.ListAdapters.ForUploadListAdapter forUploadListAdapter;
private ArrayList list_forUpload_id = new ArrayList<>();
private ArrayList list_forUpload_name = new ArrayList<>();
private ArrayList list_forUpload_address = new ArrayList<>();

CheckBox select_All;

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

    New_forUpload_List= findViewById(R.id.listview_forUpload);
    select_All = findViewById(R.id.chckbox_selectall_forUpload);
    viewData_forUpload();
    New_forUpload_List.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

        }
    });
    select_All.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {

        }
    });

    
}

public void viewData_forUpload() {
    db = new DatabaseHelper(getApplicationContext());
    sqLiteDatabase = db.getReadableDatabase();
    Cursor cursor = sqLiteDatabase.rawQuery("SELECT ID, (Last_Name || ' ' || First_Name || ' ' || Middle_Name) as Name, (Barangay || ' ' || Town) as Address FROM FOR_UPLOAD", null);
    list_forUpload_id.clear();
    list_forUpload_name.clear();
    list_forUpload_address.clear();

    if (cursor.moveToFirst()) {
        do {
            list_forUpload_id.add(cursor.getString(cursor.getColumnIndex("ID")));
            list_forUpload_name.add(cursor.getString(cursor.getColumnIndex("Name")));
            list_forUpload_address.add(cursor.getString(cursor.getColumnIndex("Address")));
        }
        while (cursor.moveToNext());
    }
    forUploadListAdapter = new com.vicjames.irca.ListAdapters.ForUploadListAdapter(getApplicationContext(),
            this.list_forUpload_asc_rec,
            this.list_forUpload_name,
            this.list_forUpload_address);

    New_forUpload_List.setAdapter(forUploadListAdapter);
    cursor.close();
}

**ForUploadListAdapter**

public class ForUploadListAdapter extends BaseAdapter
{
private Context context;
private ArrayList list_upload_id;
private ArrayList list_upload_name;
private ArrayList list_upload_address;

public ForUploadListAdapter(Context context, ArrayList<String> list_upload_id, ArrayList<String> list_upload_name, ArrayList<String> list_upload_address) {
    this.context = context;
    this.list_upload_id = list_upload_id;
    this.list_upload_name = list_upload_name;
    this.list_upload_address = list_upload_address;
}

@Override
public int getCount() {
    return list_upload_id.size();
}

@Override
public Object getItem(int i) {
    return null;
}

@Override
public long getItemId(int i) {
    return 0;
}

@Override
public View getView(int i, View view, ViewGroup viewGroup) {
    ForUploadListAdapter.Holder holder;
    if (view == null)
    {
        @SuppressLint("WrongConstant") LayoutInflater layoutInflater =(LayoutInflater) this.context.getSystemService("layout_inflater");
        view = layoutInflater.inflate(R.layout.layout_for_upload_list, null, true);
        holder = new ForUploadListAdapter.Holder();
        holder.holder_fordownload_id = view.findViewById(R.id.holder_id_forUpload);
        holder.holder_fordownload_name = view.findViewById(R.id.holder_name_forUpload);
        holder.holder_fordownload_address = view.findViewById(R.id.holder_address_forUpload);
        view.setTag(holder);
    }
    else
    {
        holder = (ForUploadListAdapter.Holder)view.getTag();
    }
    holder.holder_fordownload_id.setText(list_upload_id.get(i));
    holder.holder_fordownload_name.setText(list_upload_name.get(i));
    holder.holder_fordownload_address.setText(list_upload_address.get(i));

    if (i % 2 == 1)
    {
        view.setBackgroundColor(Color.parseColor("#708090"));
    }
    else
    {
        view.setBackgroundColor(Color.parseColor("#00574B"));
    }

    return view;
}

public class Holder
{
    CheckBox holder_fordownload_id;
    TextView holder_fordownload_name, holder_fordownload_address;

    private Holder()
    {

    }
}

}


I tried (this)(1) but I can't make it work..

can anyone give me idea how to implement this function in my project..

Thank you in advance..


  (1): https://www.tutorialspoint.com/how-to-get-all-checked-items-in-a-listview-in-android

¿Existe Android Drawabble importer para Adroid Studio 4?

¡Gracias por contribuir en StackOverflow en español con una respuesta!

  • Por favor, asegúrate de responder a la pregunta. ¡Proporciona información y comparte tu investigación!

Pero evita

  • Pedir ayuda o aclaraciones, o responder a otras respuestas.
  • Hacer declaraciones basadas en opiniones; asegúrate de respaldarlas con referencias o con tu propia experiencia personal.

Para obtener más información, consulta nuestros consejos sobre cómo escribir grandes respuestas.

java – Flying fish game,want to increase speed when score get high(android studio)

i want fish to increase speed when score get high.

package com.example.theflyingfishgameapp;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageItemInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

public class FlyingFishView extends View
{
private Bitmap fish() = new Bitmap(2);
private int fishX = 10;
private int fishY;
private int fishSpeed;

private int canvasWidth,canvasHeight;

private int yellowX,yellowY,yellowSpeed = 10;
private Paint yellowPaint = new Paint();

private int  greenX,greenY,greenSpeed = 20;
private Paint greenPaint = new Paint();

private int  redX,redY,redSpeed = 25;
private Paint redPaint = new Paint();

private int score, lifeCounterOfFish;

private boolean touch = false;

private Bitmap backgroundImage;
private Paint scorePaint = new Paint();
private Bitmap life() = new Bitmap(2);

public FlyingFishView(Context context)
{
    super(context);
    fish(0) = BitmapFactory.decodeResource(getResources(),R.drawable.fish1);
    fish(1) = BitmapFactory.decodeResource(getResources(),R.drawable.fish2);

    backgroundImage = BitmapFactory.decodeResource(getResources(),R.drawable.background);

    yellowPaint.setColor(Color.YELLOW);
    yellowPaint.setAntiAlias(false);

    greenPaint.setColor(Color.GRAY);
    greenPaint.setAntiAlias(false);

    redPaint.setColor(Color.RED);
    redPaint.setAntiAlias(false);

    scorePaint.setColor(Color.WHITE);
    scorePaint.setTextSize(70);
    scorePaint.setTypeface(Typeface.DEFAULT_BOLD);
    scorePaint.setAntiAlias(true);

    life(0) = BitmapFactory.decodeResource(getResources(),R.drawable.hearts);
    life(1) = BitmapFactory.decodeResource(getResources(),R.drawable.heart_grey);

    fishX = 550;
    score = 0;
    lifeCounterOfFish = 3;
}

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    canvasWidth = canvas.getWidth();
    canvasHeight=canvas.getHeight();
    canvas.drawBitmap(backgroundImage,0,0,null);
    int minFishY = fish(0).getHeight();
    int maxFishY = canvasHeight - fish(0).getHeight() * 3;
    fishY = fishY + fishSpeed;
    if (fishY<minFishY)
    {
        fishY = minFishY;
    }
    if (fishY>maxFishY)
    {
        fishY = maxFishY;
    }
    fishSpeed = fishSpeed + 2 ;


    if(touch)
    {
         canvas.drawBitmap(fish(1),fishX,fishY,null);
         touch= false;
    }
    else
    {
        canvas.drawBitmap(fish(0),fishX,fishY,null);
    }


    yellowX = yellowX - yellowSpeed;
    if(hitBallChecker(yellowX,yellowY))
    {
        score = score + 10;
        yellowX = -100;
    }
    if (yellowX < 0 )
    {
        yellowX = canvasWidth + 21;
        yellowY = (int) Math.floor(Math.random()* (maxFishY - minFishY)) + minFishY;
    }

    canvas.drawCircle(yellowX,yellowY,25,yellowPaint);

    //Green
    greenX = greenX - greenSpeed;
    if(hitBallChecker(greenX,greenY))
    {
        score = score + 20;
        greenX = -100;
    }
    if (greenX < 0 )
    {
        greenX = canvasWidth + 21;
        greenY = (int) Math.floor(Math.random()* (maxFishY - minFishY)) + minFishY;
    }

    //DangerRedBall
    redX = redX - redSpeed;
    if(hitBallChecker(redX,redY))
    {
        redX = -100;
        lifeCounterOfFish--;

        if (lifeCounterOfFish == 0)
        {
            Toast.makeText(getContext(),"Game Over",Toast.LENGTH_SHORT).show();

            Intent gameOverIntent = new Intent(getContext(),GameOverActivity.class);
            gameOverIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            gameOverIntent.putExtra("score",score);
            getContext().startActivity(gameOverIntent);
        }
    }
    if (redX < 0 )
    {
        redX = canvasWidth + 21;
        redY = (int) Math.floor(Math.random()* (maxFishY - minFishY)) + minFishY;
    }


    canvas.drawCircle(redX,redY,30,redPaint);

    canvas.drawText("Score : " + score ,20,60,scorePaint);

    for (int i=0;i<3;i++)
    {
        int x =(int)  (580 + life(0).getWidth() * 1.5 * i);
        int y = 30;

        if (i < lifeCounterOfFish)
        {
            canvas.drawBitmap(life(0),x,y ,null);
        }
        else
        {
            canvas.drawBitmap(life(1),x,y,null);
        }
    }





    canvas.drawBitmap(life(0),580,10,null);
    canvas.drawBitmap(life(0),640,10,null);
    canvas.drawBitmap(life(0),780,10,null);
}



public boolean hitBallChecker(int x,int y)
{
    if (fishX < x && x <(fishX + fish(0).getWidth()) && fishY < y && y <(fishY + fish(0).getHeight()))
    {
        return true;
    }
    return false;
}

@Override
public boolean onTouchEvent(MotionEvent event)
{
    if(event.getAction() == MotionEvent.ACTION_DOWN)
    {
        touch = true;
        fishSpeed = -22;
    }
    return true;
}

}