#StackBounty: #android #cordova #google-chrome #google-chrome-devtools #phonegap Cordova app crashes when using Chrome DevTools

Bounty: 150

I’m creating an app in Cordova for Android, and I’m using Chrome DevTools for debugging. But everytime I use inspect element my app crashes without showing any errors.

It won’t happen if I just start DevTools and my app, it will only happen when I use inspect element. I don’t have much code yet, only an index file that loads all the JavaScript and CSS files and shows some images for my loading page.

There are no errors showing up in my console either.

Chrome Version 57.0.2987.133
Samsung Galaxy Edge 7
Android 7.0
Cordova 6.5.0

UPDATE:
Tested in a newer version of Chrome (58.0.3029.96) and the problem still exists.

UPDATE:
I’m using a real device but the problem also exists when using emulated devices through Android Studio.


Get this bounty!!!

#StackBounty: #android #pjsip How to know incoming call have video or not in PJSIP in android

Bounty: 50

I’m working on PJSIP in android, How to check incoming call is only audio call or video.?? How identify? I have used below code but it’s not working

 @Override
    public void onIncomingCall(OnIncomingCallParam prm) {
        System.out.println("======== Incoming call ======== ");
        MyCall call = new MyCall(this, prm.getCallId());
        try {
            CallSetting setting = call.getInfo().getSetting();
            Log.d(" Log APP ", "onIncomingCall: Audio " + setting.getAudioCount() + "  Video" + setting.getVideoCount());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

But audio and video count always come 1 but while making call, I have put video 0

 MyCall call = new MyCall(account);
        CallOpParam prm = new CallOpParam();
        CallSetting setting = new CallSetting();
        setting.setAudioCount(1);
        setting.setVideoCount(0);
        prm.setOpt(setting);
        try {
            call.makeCall(buddy_uri, prm);
        } catch (Exception e) {
            call.delete();
            e.printStackTrace();
            return;
        }

Please tell me hows to identify incoming call has video or not .?


Get this bounty!!!

#StackBounty: #android #recyclerview #android-progressbar #recycler-adapter ProgressBar is not refreshing in RecyclerView.Adapter

Bounty: 50

I am facing an issue with progressBar.setProgress and progressBar.setMax.

I am having two items and generally need to show the progress of the video as like attached screen shot. For first item only I have the some progress data after set that progress I need to set progress to 0(zero) for second item. But second item progressbar is not resetted to back to zero instead of this it is still showing first item’s progress length.

I printed the values for Items here:

// Item1
Media List total Duration : 84063
Media List total ProgressDuration : 19380
// Item2
Media List total Duration : 0
Media List total ProgressDuration : 0

Adapter Code :

class ViewHolder extends RecyclerView.ViewHolder {
    TextView fileName;
    ImageView ivThumbNail;
    ProgressBar progressBar;
    View mainContainer;
    View view;

    ViewHolder(View itemView) {
        super(itemView);
        view = itemView;
        mainContainer = itemView.findViewById(R.id.main_container);
        fileName = (TextView) itemView.findViewById(R.id.tv_file_name);
        ivThumbNail = (ImageView) itemView.findViewById(R.id.iv_thumbnail);
        progressBar = (ProgressBar) itemView.findViewById(R.id.progress_bar);
    }
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(context).inflate(R.layout.media_row, parent, false);
    return new ViewHolder(itemView);
}

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    final Media media = mediaList.get(position);

    String videoUrl = media.video_url;

    int totalDuration = VideoPositionVo.getTotalDuration(context, videoUrl, media.course_id);
    int progressDuration = VideoPositionVo.getResumedPosition(context, videoUrl, media.course_id);

    Log.d("Media List total Duration : " , totalDuration);
    Log.d("Media List total ProgressDuration : " , progressDuration);

    holder.progressBar.invalidate();
    holder.progressBar.setMax(totalDuration);
    holder.progressBar.setProgress(progressDuration);


    String sampleThumbNail = "https://i.vimeocdn.com/video/23566238_100x75.webp";
    aQuery.id(holder.ivThumbNail).image(sampleThumbNail, true, true, imageWidth, 0);
    holder.fileName.setText(media.video_label);

}

Adapter row xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:elevation="4dp"
    android:foreground="?android:attr/selectableItemBackground"
    android:orientation="vertical"
    android:paddingBottom="4dp"
    android:paddingEnd="4dp"
    app:cardCornerRadius="2dp"
    app:cardElevation="2sp"
    app:cardUseCompatPadding="true">


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/iv_thumbnail"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clickable="false"
            android:scaleType="centerCrop"
            android:contentDescription="@string/media"
            android:visibility="visible" />

        <RelativeLayout
            android:id="@+id/main_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/black_transparent_dark">

            <ImageView
                android:id="@+id/iv_file_type"
                android:layout_width="76dp"
                android:layout_height="76dp"
                android:layout_centerInParent="true"
                android:contentDescription="@string/media"
                android:scaleType="centerCrop"
                android:src="@drawable/ic_play" />

            <TextView
                android:id="@+id/tv_file_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:layout_above="@+id/progress_bar"
                android:ellipsize="end"
                android:gravity="center"
                android:maxLines="2"
                android:text="fileName"
                android:textColor="@color/white"
                android:textStyle="bold" />


            <ProgressBar
                android:id="@+id/progress_bar"
                style="@android:style/Widget.ProgressBar.Horizontal"
                android:layout_width="match_parent"
                android:layout_height="6dp"
                android:indeterminate="false"
                android:layout_alignParentBottom="true"
                android:max="0"
                android:progress="0"
                android:progressDrawable="@drawable/video_progress_bar"
                android:visibility="visible" />
        </RelativeLayout>   

    </RelativeLayout>

</android.support.v7.widget.CardView>

Screen Shot :
screenshot


Get this bounty!!!

#StackBounty: #android #recyclerview #android-textview #android-recyclerview "android:textIsSelectable="true" not workin…

Bounty: 50

I know that setting android:textIsSelectable="true" in xml for the TextView will show the native text selection popup and I’ve been using that in my application. But what I found that it is not working any more when I try to set the same attribute in a view attached to the RecyclerView.
Whenever I try to select the text the following log appears –

TextView: TextView does not support text selection. Action mode cancelled.

And I don’t know why? Why it works on other screens and not with the RecyclerView. I read multiple posts –

TextView with android:textIsSelectable="true" not working in listview

textview textIsSelectable="true" not working in Listview

android:textIsSelectable="true" for TextView inside Listview does not work

But then I encountered this post –

Android: "TextView does not support text selection. Action mode cancelled"

And the reply by @hungkk worked for me. His solution suggested the TextView width to change to wrap_content from match_parent.

I know I can do this but my question is how this fixed the issue because it looks weird to me. And also, what is the solution if I want to keep the width to match_parent.

Any inputs are welcome.


Get this bounty!!!

#StackBounty: #java #android #android-studio #android-gradle #nine-patch Error on nine patch image: Some file crunching failed, see log…

Bounty: 250

I cannot add a ninepatch png to my project because of this build error:

Information:Gradle tasks [:app:assembleDebug] Error:Some file
crunching failed, see logs for details Error:Execution failed for task
‘:app:mergeDebugResources’.

Error: Some file crunching failed, see logs for details Information:BUILD FAILED Information:Total time: 11.955 secs
Information:2 errors Information:0 warnings Information:See complete
output in console

Fact: I have already added one which runs perfectly, the other one is made with the very same methodology, same boundaries and stuff yet makes build error.

I have tried:

  • Clean
  • Rebuild project
  • Restart AS
  • Restart PC
  • Made nine patch with Photoshop
  • Made nine patch with AS built in nine patch maker
  • Various naming conventions
  • Shorten the dir path of the project
  • Adding crunch: false to gradle

Extra wtf:

  • If i just copy the pixel contents of the not working nine patch to the working one the error appears.

Also, the error says “see logs”

Where are the logs???

Because its not in logcat thats for sure.

Please help if you can. This drives me nuts.
Im really interested why I have to spend half a day with an image import.


Get this bounty!!!

#StackBounty: #android #drawable #android-drawable Android: Drawable vertically alignment for SeekBar

Bounty: 50

This is waht I need to achieve with xml drawable for SeekBar:
enter image description here

I tried many different variations and this is best I could make.

This is seekbar_thumb_drawable.xml:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >

    <solid android:color="@color/accent_color"/>

    <size
        android:height="20dp"
        android:width="20dp" />

</shape>

This is seekbar_drawable.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@android:id/background"
        android:height="5dp"
        android:top="7.5dp">
        <shape
            android:shape="rectangle">
            <solid android:color="@color/seekbar_background" />
            <corners android:radius="2.5dp" />
        </shape>
    </item>

    <item
        android:id="@android:id/progress"
        android:height="10dp"
        android:top="5dp">
        <clip>
            <shape
                android:shape="rectangle">
                <solid android:color="@color/seekbar_progress" />
                <corners android:radius="5dp" />
            </shape>
        </clip>
    </item>

</layer-list>

Result on API 18:
Problem is that lines are not verticaly centered.

enter image description here

Result on API 24:
This display exactly how I want it to display.

enter image description here

Is there any possible solution to make this appear as on first picture on all devices from API 16?
I do not want to use nine-patch, because I need to use color from resources.
I tried padding, gravity, top, bottom, inter-shape, line, rectangle but I could not find solution…


Get this bounty!!!

#StackBounty: #android #arraylist #filtering #android-adapter #autocompletetextview Get filtered array size in AutoCompleteTextview

Bounty: 50

I am working on the project in which user can search data. For that, I have implemented AutoCompleteTextView.

 autoComplete.setAdapter(new ArrayAdapter<String>(CheckRiskActivity.this,
                                        R.layout.auto_text_row, druglist));
                                autoComplete.setThreshold(1);
//druglist is my arraylist

Text change listener is as below:

autoComplete.addTextChangedListener(new TextWatcher() {

        @Override
        public void afterTextChanged(Editable s) {
            // here I want to get the size of filtered array list every time when the user adds any character.
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start,
                                      int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start,
                                  int before, int count) {
        }
    });

Explanation: If my initial array size is 100 and if the user types ‘a’, then I want to get the size of filtered array.

Note: I have tried autoComplete.getAdapter().getCount(); but it gives the actual result after adding one more character.


Get this bounty!!!

#StackBounty: #c# #android #xamarin How to simulate screen touch on android with xamarin?

Bounty: 50

I am making an application for automating certain things, for example while having a 3rd party app open, my application, running in the background, would simulate a click on the screen, at given coordinates, which would look like a regular screen tap to the 3rd party app.

But I am stuck on the actual screen tap simulation, how can I achieve it with Xamarin for Android?

The app will have root privileges.

Thank you.


Get this bounty!!!

#StackBounty: #android #ios #react-native What are my options for storing data when using React Native? (iOS and Android)

Bounty: 100

I am still new in the React Native world, and generally in the mobile/native world as well, and I am finding the documentation a bit lacking when it comes to data persistence.

What are my options for storing data in React Native and the implications of each type? For instance, I see that there is local storage and async storage, but then I also see things like Realm, and I’m confused how all of this would work with an outside database.

I specifically want to know:

  • What are the different options for data persistence?
  • For each, what are the limits of that persistence (i.e., when is the data no longer available)? For example: when closing the application, restarting the phone, etc.
  • For each, are there differences (other than general setup) between implementing in iOS vs Android?
  • How do the options compare for accessing data offline? (or how is offline access typically handled?)
  • Are there any other considerations I should keep in mind?

Thanks for your help!


Get this bounty!!!

#StackBounty: #android #retrofit #rx-java Don't re-execute Retrofit call if it's still in progress using RxJava

Bounty: 50

My goal is a method that will execute a network call unless the network call is already in progress in which case the caller subscribes to the results of the existing call.

Here is what I have, it mostly works:

private AsyncSubject<Stuff> asyncSubject;

public Observable<Stuff> getStuff() {
    if (asyncSubject == null) {
        asyncSubject = AsyncSubject.create();
        asyncSubject
            .doAfterTerminate(new Action() {
                @Override
                public void run() throws Exception {
                    asyncSubject = null;
                }
            })
            .subscribe();
        retrofitApi.getStuff()
            .subscribe(asyncSubject);
    }
    return asyncSubject
        .someOperatorsHere();
}

This mostly works because asyncSubject nulls itself out on terminate so that any subsequent calls will re-execute the network request.

But there is a bug, there’s a window between if (asyncSubject == null) and return asyncSubject where doAfterTerminate can execute and I get a null pointer.

Any ideas how to fix the bug. Maybe there is a more elegant Rx way to do this? Or synchronized block. Or a way to query Retrofit for network progress.


Get this bounty!!!