android – I want my buttons to be switchable in recyclerView, so if you click each other, they should all be hidden

When I click on a button, it should be deselected how to do that

I saw other answers in the stack but none solved my problem or I could not rest properly

The public class LocationAreaAdapter extends RecyclerView.Adapter {

private int mSelectedItem = -1;
private ArrayList mNames = new ArrayList <> ();
private context mContext;
private ArrayList isChecked = new ArrayList <> ();

private AdapterView.OnItemClickListener onItemClickListener;

public LocationAreaAdapter (context context, ArrayList mNames) {

this.mContext = context;
this.mNames = mNames;
}

@NonNull
@Override
public ViewHolder onCreateViewHolder (@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from (viewGroup.getContext ()). Inflate (R.layout.locatin_area_cardview, viewGroup, false);
return new ViewHolder (view, this);
}


@Override
public void onBindViewHolder (@NonNull ViewHolder holder, int i) {

holder.name.setText (mNames.get (i));
holder.name.setChecked (i == mSelectedItem);

// what to do here
}


@Override
public int getItemCount () {
return mNames.size ();
}

public void onItemHolderClick (ViewHolder owner) {
if (onItemClickListener! = null)
onItemClickListener.onItemClick (null, holder.itemView, holder.getAdapterPosition (), holder.getItemId ());
}

public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

RadioButton name;
LocationAreaAdapter mAdapter;
public ViewHolder (View itemView, final LocationAreaAdapter mAdapter) {
great (itemView);
this.mAdapter = mAdapter;
name = itemView.findViewById (R.id.location_area_button);
itemView.setOnClickListener (this);
name.setOnClickListener (this);

}

@Override
public void onClick (View v) {
mSelectedItem = getAdapterPosition ();
notifyItemRangeChanged (0, mNames.size ());
mAdapter.onItemHolderClick (ViewHolder.this);
}
}
}

if I click on the button, the button is not clicked but recyclerview flashes

Command Line – Compile ffmpeg for Android

I'm trying to compile ffmpeg for Android. I followed the steps in the tutorial. Here is the link to the same https://yesimroy.gitbooks.io/android-note/content/compile_ffmpeg_for_android.html

What I tried

  1. Downloaded ffmpeg source.
  2. Downloaded NDK for Android.
  3. Download the build scripts and add appropriate paths by editing the script with the text editor.

Example my bash script. I changed the path on my system during execution.

#! / bin / bash
NDK = / Users / yesimroy / Library / Android / sdk / ndk bundle
PLATFORM = $ NDK / platform / android-21 / arch-arm64 /
TOOLCHAIN ​​= $ NDK / toolchains / aarch64-linux-android-4.9 / prebuilt / darwin-x86_64
PREFIX =. / Android / arm64

Function build_one
{
./configure 
--prefix = $ PREFIX 
--enable-static 
--enable-pic 
--host = aarch64-linux 
--cross-prefix = $ TOOLCHAIN ​​/ bin / aarch64-linux-android 
--sysroot = $ PLATFORM

clean up
do
make install
}

build_one

Echo Android ARM64 builds ready

The same thing happens in the terminal

/ Desktop / x264 $ ./build_android_arm.sh
No working C compiler found.
Makefile: 3: config.mak: No such file or directory
./configure
Found no assembler
The minimum version is nasm-2.13
If you really want to compile without asm, configure with --disable-asm.
Makefile: 337: Recipe for Destination & # 39; config.mak & # 39; failed
do: *** [config.mak] Error 1
Makefile: 3: config.mak: No such file or directory
./configure
Found no assembler
The minimum version is nasm-2.13
If you really want to compile without asm, configure with --disable-asm.
Makefile: 337: Recipe for Destination & # 39; config.mak & # 39; failed
do: *** [config.mak] Error 1
Makefile: 3: config.mak: No such file or directory
./configure
Found no assembler
The minimum version is nasm-2.13
If you really want to compile without asm, configure with --disable-asm.
Makefile: 337: Recipe for Destination & # 39; config.mak & # 39; failed
do: *** [config.mak] Error 1
Android ARM builds are done

The path for a particular architecture under NDK is "/home/raghu/Android-SDK/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android".

Something missing?

I found some tutorials https://medium.com/@ilja.kosynkin/building-ffmpeg-4-0-for-android-with-clang-642e4911c31e

My target for Android is at least Android 21, which I think is lollipop.

But I'm not sure if I'm missing something. Let me know if anything else needs to be added to the questions.

Samsung Galaxy S – uses dual messenger, disabled work profile on Pixel Launcher, now Android prompts me to activate the secure folder, and I can not access it

So I started using Dual Messenger in the advanced settings for Facebook, and I'm using the Pixel Launcher. This appeared when I turned on the dual messenger

work profile

The toggle-for-work profile was initially enabled. I turned off the switch to see what would happen, and then the dual messenger apps were greyed out and I could not turn the switch back on, it just went back to the home screen and did nothing. I was able to re-enable the Dual Messenger Facebook via Settings> Advanced Features, but Secure Folder (called Gallery by myself) relayed this message when I tried to open it.

secure folder

It happens when I try to access it through settings, the icon, the quick tile or even safe mode. If you tap Power, I'll return to the Samsung Experience home screen. If you tap it a few times, the error "Android system stopped" appears.

Is there a way to fix this or at least to store data in t?

To generate PDF for the entire list view in Android

I created the bitmap and created the PDF file for the bitmap. but I have to generate pdf for the entire list view, which is scrollable. Given below is my code, please give me a suggestion, thanks in advance! I could not find the PDF authoring application that could copy the entire UI or, in my case, paste the entire list view into the PDF. If anyone could suggest what could be done in this case, I would be grateful.

    public class MainActivity extends AppCompatActivity {
private button btn;
private linear layout llScroll;
private bitmap bitmap;
private ListView listView;
assembly list my list;

@Override
protected void onCreate (bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
btn = findViewById (R.id.btn);
llScroll = findViewById (R.id.llScroll);
listView = (ListView) findViewById (R.id.listView);
string[] names = new String[]{"One, two, three, four, five, six, seven, one, two, three, four, five" Six "," Seven "};
array adapter arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, android.R.id.text1, names);
listView.setAdapter (arrayAdapter);
btn.setOnClickListener (new View.OnClickListener () {
@Override
public void onClick (View v) {
Log.d ("size", "" + llScroll.getWidth () + "" + llScroll.getWidth ());
bitmap = loadBitmapFromView (llScroll, llScroll.getWidth (), llScroll.getHeight ());
getWholeListViewItemsToBitmap ();
Create PDF ();
}
});
}

public bitmap getWholeListViewItemsToBitmap () {
ListAdapter adapter = listView.getAdapter ();
int itemscount = adapter.getCount ();
int allitemsheight = 0;
list bmps = new ArrayList();
for (int i = 0; i <itemscount; i ++) {
View childView = adapter.getView (i, null, listView);
childView.measure (View.MeasureSpec.makeMeasureSpec (listView.getWidth (), View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec (0, View.MeasureSpec.UNSPECIFIED));
childView.layout (0, 0, childView.getMeasuredWidth (), childView.getMeasuredHeight ());
childView.setDrawingCacheEnabled (true);
childView.buildDrawingCache ();
bmps.add (childView.getDrawingCache ());
allitemsheight + = childView.getMeasuredHeight ();
}
Bitmap bigbitmap = Bitmap.createBitmap (listView.getMeasuredWidth (), allitemsheight, Bitmap.Config.ARGB_8888);
Canvas bigcanvas = new canvas (bigbitmap);
Paint paint = new Paint ();
int iHeight = 0;
for (int i = 0; i <bmps.size (); i ++) {
Bitmap bmp = bmps.get (i);
bigcanvas.drawBitmap (bmp, 0, iHeight, paint);
iHeight + = bmp.getHeight ();
bmp.recycle ();
bmp = zero;
}
Return bigbitmap;
}

public static bitmap loadBitmapFromView (View v, int width, int height) {
Bitmap b = Bitmap.createBitmap (Width, Height, Bitmap.Config.ARGB_8888);
Canvas c = new canvas (b);
v.draw (c);

return b;
}

private void createPdf () {
WindowManager wm = (WindowManager) getSystemService (Context.WINDOW_SERVICE);
DisplayMetrics displaymetrics = new DisplayMetrics ();
this.getWindowManager (). getDefaultDisplay (). getMetrics (displaymetrics);
float hight = displaymetrics.heightPixels;
float width = displaymetrics.widthPixels;
int convertHighet = (int) hight, convertWidth = (int) width;
PdfDocument document = new PdfDocument ();
PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder (convertWidth, convertHighet, 1) .create ();
PdfDocument.Page page = document.startPage (pageInfo);
Canvas canvas = page.getCanvas ();
Paint paint = new Paint ();
canvas.drawPaint (paint);
bitmap = Bitmap.createScaledBitmap (bitmap, convertWidth, convertHighet, true);
paint.setColor (Color.BLUE);
canvas.drawBitmap (bitmap, 0, 0, null);
document.finishPage (page);
// write the document content
String targetPdf = "/sdcard/pdffromScroll.pdf";
File filePath;
filePath = new file (targetPdf);
To attempt {
document.writeTo (new FileOutputStream (filePath));
} catch (IOException e) {
e.printStackTrace ();
Toast.makeText (this, "Something's wrong:" + e.toString (), Toast.LENGTH_LONG) .show ();
}
document.close ();
Toast.makeText (this, "PDF is created by Scroll !!!", Toast.LENGTH_SHORT) .show ();
openGeneratedPDF ();

}

private void openGeneratedPDF () {
File file = new File ("/ sdcard / pdffromScroll.pdf");
if (file.exists ()) {
Intent intent = new Intent (Intent.ACTION_VIEW);
Uri uri = Uri.fromFile (file);
intent.setDataAndType (uri, "application / pdf");
intent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP);
To attempt {
startActivity (intention);
} catch (ActivityNotFoundException e) {
Toast.makeText (MainActivity.this, "No application to view PDFs available", Toast.LENGTH_LONG) .show ();
}
}
}}

android – In the web view, you can not scroll over the image

I have developed a webview app for Android and iOS. I've noticed that I can not scroll over a specific HTML element in the Android app while it works on iOS.

This is the website.

This is the picture I'm talking about, basically every product image on the website
Enter image description here

HTML


If I visit the website from the smartphone's Chrome browser, does it work, so it must be a bug in the web view?

How to Create a Twitch Chatbot for Android in Java

I recently started Android Android and Java in Android Dev.

Since most of my projects are chat bots, I thought it was cool to implement a Twitch chat bot that could run on my Android phone.
I used Python queries and Twitchio API to create my bot. I do not know much about web developers and I have no front-end experience.

I think the main problem is … how do I create a high performance bot that does not consume too much battery?

Another problem could be, should I make it more server-side? Or should I find a way to solve the battery problem without having a server I can rely on?

What do you think?

Which SDK version should I use for the implementation?

I am also looking for documents to create this project. I will appreciate any resource related to the Twitchio API, and generally with the SDK and Android Studio. What I can use to make the transition from Python.

If necessary … I can provide the current code of my Python Twitch Bot on Github.

android – Why does not an integer format properly (Kotlin / Java)?

I use the Android Studio 3.4.2, I ran a test code that generates a very strange format. This excerpt was published shortly after the beginning of the year onCreate, And it's a pure integer!

fmtFloat = DecimalFormat ("#, ###. ##############")
fmtFloat.setRoundingMode (RoundingMode.CEILING)
Log.d ("myMess", fmtFloat.format ("98765432" .toDouble ())

The picture of the LogCat and

LogCat

When I run this expression in the evaluation window, the same problem occurs:

Evaluate window

However, if I have cracked the same code as a test on the desktop in the Android Studio No error is displayed.

98,765,432

OK also works on the Kotlin Playground.

Because that happens in Android App and happens on the desktop? What is the difference

Because it is a library Javaput the Java in the question Kotlin,

Android Galaxy S9

in "Contacts" of "Callnumbertype"
* Mobile phone, mobile phone
*At home
*Job
*Fax
* Pager

No matter what you enter in Edit,
it is still displayed as "Other"
If you return to the edit screen, it will be there, but if you say "OK," "Other" will be displayed again.

android – image that is displayed and hidden in a MotionLayout

I'm trying to get a look with an image and remove the effect, but that does not work.

I enter the code of the image that should appear and disappear,



This is the motionScene code



    
        
            
            
        
    
    
        
    
    
        
    

The picture can be seen, but MotionScene does not work. I have defined the start points and keyframes for the transition, but it does not start because I assume it starts automatically from frame 0 to 50 and then to 100.

Any suggestions?