Since I'm not quite sure when, I'm getting a lint warning when viewing my layout file of "Unknown attribute android:padding"...

The layout file starts:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="@dimen/widget_margin"
    android:id="@+id/widget" >

I'm getting similar warnings for android:layout_alignParentTop etc in the following:

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/imageView_port"
    android:visibility="gone"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

Furthermore, I'm finding now that when an image is loaded into the ImageView that is the correct aspect ratio but not the right pixel size (smaller), the image is being shown in the ImageView at its actual (too small) size rather than being stretched out to fit the ImageView (like it used to do, and like I want it to do).

I'm not sure when these warnings started to appear. And I'm confused because it appears that at least android:padding is still a valid attribute according to the docs.

Other warnings I'm getting include for android:tag... which is also a pretty basic attribute and still "legal" according to the above docs.

Hi I am using SDWebImage to set image to a button in xcode 10.2.1.

I am trying the following

import SDWebImage

cell.bProfileImage.sd_setImage(with:URL(string: individualChatsListArray[indexPath.row].profile_image), forState:.normal)

But I am getting the following error

Value of optional type 'UIButton?' must be unwrapped to refer to member 'sd_setImage' of wrapped base type 'UIButton'

In the nib file the items are linked and declared as per below

@IBOutlet weak var bProfileImage: UIButton!


@IBAction func bProfileImage(_ sender: Any) {

    print("touch kia")

}

I have tried

    cell.bProfileImage?.sd_setImage(with:URL(string: individualChatsListArray[indexPath.row].profile_image), forState:.normal)

But then getting the following error

Ambiguous reference to member 'bProfileImage'

As you can see I am new to xcode/swift

I have to expose some sensitive data containing a PII column that has a 25 digit number. Rest of the columns aren't PII data. This is done such that the data can be safely shared to the larger audience without the original PII column's data. but if required I need to check the original value, hence a look up file is needed which maps the PII with its pseudo number.

How do I generate a pseudo unique number such that we can later map back to original data if required ?

Currently there are about 22 million rows. There could be at max 50 million such rows of data later on as the data keeps coming in.

I was thinking of the UUIDs but they aren't really human friendly & UUIDs would be bad at indexing later on if we move to a database (Over thinking much?). Also joining two dataframes based on indexing could be slow I reckon.

My current thought process using pandas (for the first file containing 22 million rows)

  1. shuffle the lines with pandas (assuming it fits in memory)
  2. add a column with a auto incrementing field (say Psuedo_number)
  3. add another column with uuids (UUID4)
  4. Create a lookup file with our new pseudo_number, UUID, original PII number

now when new PII data comes in

  1. read the highest value of the pseudo_number from the lookup file
  2. use that (+1) as the starting number for the above process on the new data

tldr I need to generate unique random numbers for PII column in a file containing 22 millions rows & maintaining a look up file. Later would need to import into a database once system grows.

some intial code:

<!-- language: lang-py -->

# dummy list
>>> l = [('C0000005', 'RB', 'C0036775', '')] * 27000000
# create a sample dataframe to represents our data of 22+ million rows
>>> df = pd.DataFrame(l, columns=list('abcd'))
# let the following 'sensitive_col' column represent our 25 digit number for now
>>> df['sensitive_col'] = df.index + 123456789

>>> df.head()


a          b             c        d         sensitive_col
0   C0000005    RB  C0036775    D185368     123456789
1   C0000005    RB  C0036775    D185368     123456790
2   C0000005    RB  C0036775    D185368     123456791
3   C0000005    RB  C0036775    D185368     123456792
4   C0000005    RB  C0036775    D185368     123456793


#actual code!!
# shuffle the rows
>>> df = df.sample(frac=1).reset_index(drop=True)
>>> df['New_ID'] =  df.index + 123 
# create the UUIDs
>>> df['uuid'] = [uuid.uuid4() for _ in range(len(df.index))]

>>> df.head()

           a    b         c       d     sensitive_col   New_ID  uuid
0   C0000005    RB  C0036775    D185368     132571068   123     8c1974cf-49ff-4b87-bfac-b791156d1b1b
1   C0000005    RB  C0036775    D185368     130859684   124     2a170f08-43a9-4a1d-acf5-b537a229c7e9
2   C0000005    RB  C0036775    D185368     135318849   125     5b265c8e-35ea-4100-bac0-c77f4d3f85ea
3   C0000005    RB  C0036775    D185368     145963082   126     77e2e78c-c72a-4738-907a-9e4851a328d2
4   C0000005    RB  C0036775    D185368     141664707   127     de73b056-6c5e-4276-8b93-db44cd9990ba

Any suggestions ?

When I try to send to review after just one minute I receive a reject.

My MacOs Version: MacOS 10.15 Beta ( Catalina )

My xCode: Version 11.2

I've also tried xCode: Version 11.0 beta

Mail message:

Please correct the following issues, then upload again.

ITMS-90111: Invalid Toolchain - Your app was built with a beta version of Xcode or SDK. Apps submitted to the App Store must be built with the GM version of Xcode 9 and the SDK for iOS 11, tvOS 11, watchOS 4, or macOS 10.13 or later.

Reject in App Store Connect

My project is working on Xcode 10.1, but when I am trying to work with Xcode 10.2.1, I got this issues:

"Module compiled with Swift 4.2 cannot be imported by the Swift 5.0.1 compiler: /xxx/xxx/xxx/xxx/xxx/xxx/xxx.framework/Modules/xxx.swiftmodule/i386.swiftmodule"

"Module compiled with Swift 4.2 cannot be imported by the Swift 5.0.1 compiler: /xxx/xxx/xxx/xxx/xxx/xxx/xxx.framework/Modules/xxx.swiftmodule/x86_64.swiftmodule"

I am getting this issues about embedded framework that I am using. When I checked the same issues, I didn't find any solutions on internet. Do you guys have any idea?

Thanks.

I have a TableView and if someone pressed I want that at the position of index path the checkbox will collect! At the moment only the checkbox is check when some pressed the current position of the Button.

I've already tried to call the function of the button in didselectedrow but there Xcode showing a problem by calling the function!

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    tableView.deselectRow(at: indexPath, animated: true)

    checkBoxClikced(sender: self) = indexPath.row //here Xcode shows the error
}

The function I want to call

@objc func checkBoxClikced( sender: UIButton) {
    if sender.isSelected {
        //uncheck the nuton

        sender.isSelected = false
    } else {
        //checkmark it

        sender.isSelected = true
    }
}

I am trying to make it so that when the user swipe left (the way you swipe up in many apps with tableViews to reload) in a collection view it will show a loading icon and reload data (the reload data part I can handle myself).

How can I detect this so I can call a reloadData() method?

Note: I am using a UICollectionView which only has one column and x rows. At the first cell if the user swipes left it should show a loading icon and reload data.

I am looking for a way to detect the slide left intended to reload.

What I have tried:

    let refreshControl = UIRefreshControl()

override func viewDidLoad() {
    super.viewDidLoad()
    viewDidLoadMethods()
    refreshControl.tintColor = .black
    refreshControl.addTarget(self, action: #selector(refresh), for: .valueChanged)
    collectionView.addSubview(refreshControl)
    collectionView.alwaysBounceHorizontal = true

But this only works vertically.

I have an inner interface implementing Serializable. I am seeing crashes saying that my object is not serializable, but I am not sure whether it is because the interface is declared in a class, or because of something else.

I know that classes with non serializable objects like Activity cannot be serialized, but what about interfaces with methods returning Activity objects, for instance?

How to download apk file in xamarin android from webserver. I used download manager and request object for download files. Jpg pdf and other files download successfully. but apk file download unsuccessfully

I'm having an weird problem with google admob api for android.... I dont know exactly how and when but it start creating too many threads and end up by crashing the whole system. I got this error in production and still not able to reproduce it in dev

this is the stack:

Fatal Exception: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
   at java.lang.Thread.nativeCreate(Thread.java)
   at java.lang.Thread.start(Thread.java:1063)
   at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:921)
   at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339)
   at com.google.android.gms.ads.internal.util.future.ac.execute(ac.java)
   at com.google.android.gms.ads.nonagon.ad.activeview.b.a(b.java:5)
   at com.google.android.gms.ads.internal.webview.j.a(j.java:30)
   at com.google.android.gms.ads.internal.webview.ad.a(ad.java:4)
   at com.google.android.gms.ads.internal.webview.ae.run(ae.java:2)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at aam.a(aam.java)
   at com.google.android.gms.ads.internal.util.e.a(e.java:1)
   at aam.dispatchMessage(aam.java)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:7325)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

this stack doesn't say too much is just generic but if i take a print screen of my crashlytics dashboard:

enter image description here

and this goes over and over and over if i scroll down according to crashlytics there are 1024 threads at this moment

does anyone know why it is happening

is use: api("com.google.android.gms:play-services-ads:17.2.1")

Im relatively new to coding so I have a website that i wanted to convert to an APK to upload to google play, so as Im relatively new i used the program website2apk, all that went ok so when i went to upload it to google play i had this error " Unoptimised APK Warning:

This APK results in unused code and resources being sent to users. Your app could be smaller if you used the Android App Bundle. By not optimising your app for device configurations, your app is larger to download and install on users' devices than it needs to be. Larger apps see lower installation success rates and take up storage on users' devices.

Resolution:

Use the Android App Bundle to automatically optimise for device configurations, or manage it yourself with multiple APKs."

So i installed android studio and tried importing the APK and the build is greyed out.

So decompiled it and tried importing the project, However i try to import it i get this (see the screenshot: http://prntscr.com/o2aoak). So from there im clueless on what to do as I have tried both options and both dont seem to work. Then when i tried create project from existing files it said i need to migrate to Gradle and i dont know how to do that. Thanks in advance guys

I got two layouts in Kotlin, each with one Button and I just want to switch between both. So I added an OnClickListener to both

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

        button_foward.setOnClickListener(View.OnClickListener {
            setContentView(R.layout.second)
            button_back.setOnClickListener(View.OnClickListener {
                setContentView(R.layout.activity_main)
            })
        })

Well, it is actually working. I can go to the second layout and switch back to the first, but i cannot open the second layout again!

I thought I would have to redefine the Listener after changing back to the main view, so I created two separate functions to set the views.

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        this@MainActivity.createMainScreen()
        })
    }

    fun createMainScreen(){
        setContentView(R.layout.activity_main)
        button_foward.setOnClickListener(View.OnClickListener {
            this@MainActivity.createSecondScreen()
        })
    }
    fun createSecondScreen(){
        setContentView(R.layout.second)
        button_back.setOnClickListener(View.OnClickListener {
            this@MainActivity.createMainScreen()
        })
    }

This way was working, when I tried to get rid of the same problem in Java, but in Kotlin i still can use every Button only once.

How do I solve this? Can (do I have to) reset the Buttons before redefining them?

Or might there be an alternative for the use of setContentView?

Thx for your help!

I'm currently developing an Android application with flutter.

The aim of the app is to help students to study for a quiz like exam in which you have to recognise some images and write down some information about it.

The images are always the same, so in the first version I've put them inside the assets folder of my application.

In this way it works fine, but the app size increases a lot!

I'd like to have them stored somewhere online and I think it would work to retrive them one by one with an URL if I need them.

Is there any online service I could use?

Thank you.

I am writing an app. Like Google suggests, the user should be to be able to link multiple sign in methods to their account. In order to do that, the ideas of "identities" and "accounts" are separated in the RESTful backend.

When signing up/in with a third party SDK, the access token (or ID token in the case of Google) gets sent to the backend, which then verifies and forgets about it. The app also forgets about this information, as it receives a separate bearer token from the server.

In the account settings, I now want to display a list of all linked accounts. The app receives an array containing the user IDs from the third party accounts. It should then populate the list with profile pictures and names.

The problem: Third party identity provider APIs only seem to hand out information like usernames and profile pictures if they are given the user's access token. I looked everywhere for APIs without access tokens. I thought at least the username would be public information and could be retrieved with a simple HTTP GET request and the user ID.

Google seems to have had a Google Plus API that was useful, but that is being shut down. The Google People API gives access to names, but required OAuth2 authentication. Facebook has the Graph API, which also wants the user's access token. Twitter has https://api.twitter.com/1.1/users/show.json, which requires authentication headers.

How does one go about this?

I could store the access token from the third party sign up on the client. Not only does this seem very sloppy, but it also comes with a problem: If the user buys a new phone, the access tokens are lost and the linked accounts list can't be displayed correctly.

Another possibility would be to store the access/ID token on the server. The server could then either send all access tokens back to the client when it needs them, or populate usernames and profile pictures itself. But this seems like a huge security issue. Surely, access tokens are not meant to be kept around for a long time?

The backend could store the information like the username, the email address and the profile picture the moment the user signs up with a third party account. It would then not have to keep the access token. However, if the user changes their profile information in the third party account, these changes go unnoticed. In addition to that, storing a third party profile picture on the server seems absurd.

Suppose I've got a struct declaration that looks like this:

struct Return {
    myData (*data)[];
    ...
}

Now suppose I've got an API function whose declaration looks like this:

bool API(..., struct Return *loc);

API() processes some raw data, parses it, allocates memory for it, and then saves its location to loc->data.

Return.data is supposed to be accessed in a multi-dimensional-array-like manner, e.g. data[0][3] = 'b';.

My goal for the API is to be accessed like so:

struct Return local;
API(..., &local);
local.data[0][1] = 'b';

The problem is that the size of *data (the first (of many) array that data points to) isn't known until runtime, thus the above example results in compiler errors.


The API consumer though, knows the size of *data in advance, through the use of another function. The API consumer could use the returned pointer to declare an object of a known size:

struct Return local;
API(..., &local);
myData (*localdata)[KNOWN_SIZE] = local.data;
localdata[0][1] = 'b';

To me it seems a little counter-intuitive to force the API consumer to do that. Am I wrong?

Is there another way to solve this issue?

I have a component called WordAutoCompleteTextView, which extends AutoCompleteTextView, I want the component to do the following two things.

  1. Show type in the dropdown list when the user is typing in the WordAutoCompleteTextView
  2. Show click in the dropdown list when the user clicks the WordAutoCompleteTextView

I only achieved the first one. For the second one, when the user clicks the AutoCompleteTextView, type is shown instead of click. In other words, type is always shown in the dropdown list no matter in which condition. Why? How to fix it?

Here is my code.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.dict.myapplication.WordAutoCompleteTextView
        android:id="@+id/autoCompleteTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="7dp"
        android:ems="10"
        android:text=""
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <requestFocus />
    </com.dict.myapplication.WordAutoCompleteTextView>


</android.support.constraint.ConstraintLayout>

WordAutoCompleteTextView.java

package com.dict.myapplication;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Objects;

public class WordAutoCompleteTextView extends android.support.v7.widget.AppCompatAutoCompleteTextView {
    public WordAutoCompleteTextView(Context context) {
        super(context);
        initView();
    }

    public WordAutoCompleteTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
    }

    public WordAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView();
    }

    @Override
    protected void performFiltering(CharSequence text, int keyCode) {
        super.performFiltering("", 0);
    }

    private void initView() {
        ArrayAdapter<String> adapter = new ArrayAdapter<>
                (Objects.requireNonNull(getActivity(this)),
                        android.R.layout.select_dialog_item,
                        new ArrayList<>());
        setThreshold(0);
        addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                adapter.clear();
                adapter.add("type");
                adapter.notifyDataSetChanged();
                showDropDown();
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
        setOnClickListener((view) -> {
            CharSequence text = ((TextView)view).getText();
            if (text.length() != 0) {
                adapter.clear();
                adapter.add("click");
                adapter.notifyDataSetChanged();
                showDropDown();
            }
        });
        setAdapter(adapter);//setting the adapter data into the AutoCompleteTextView
    }

    private Activity getActivity(View view) {
        Context context = view.getContext();
        while (context instanceof ContextWrapper) {
            if (context instanceof Activity) {
                return (Activity) context;
            }
            context = ((ContextWrapper) context).getBaseContext();
        }
        return null;
    }

}

enter image description here

I am creating an app using MediaPlayer to play audio file from raw folder. It works fine on android 7 and above but for android 6 it crashes. It seems MediaPlayer.setDataSource is deprecated on android 6. So what should be used to make MediaPlayer work on android 6. Is there any alternate that i can use just for making my app work on android 6.

I downloaded and tried running the sample app from developer.android.com but it also crashes on android 6.

Crash Logs -

java.lang.NoSuchMethodError: No virtual method setDataSource(Landroid/content/res/AssetFileDescriptor;)V in class Landroid/media/MediaPlayer; or its super classes (declaration of 'android.media.MediaPlayer' appears in /system/framework/framework.jar) at com.example.android.mediaplayersample.MediaPlayerHolder.loadMedia(MediaPlayerHolder.java:86) at com.example.android.mediaplayersample.MainActivity.onStart(MainActivity.java:57) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)

I want n number that means my last record of the ArrayList but the problem is my ArrayList is of custom POJO class which contains its own array that's why i am unable to identify how many records that ArrayList contains

Please check below my JSON from which I am creating a POJO class

{
  "data": [
    {
      "id": "7",
      "name": "Grand Father Name",
      "parent_id": "0",
      "relation_type": "grand-father",
      "children": [

      ]
    },
    {
      "id": "8",
      "name": "Grand Mother Name",
      "parent_id": "0",
      "relation_type": "grand-mother",
      "children": [
        {
          "id": "9",
          "name": "Father Name",
          "parent_id": "8",
          "relation_type": "father",
          "children": [
            {
              "id": "11",
              "name": "My Name",
              "parent_id": "9",
              "relation_type": "self",
              "children": [

              ]
            }
          ]
        },
        {
          "id": "10",
          "name": "Mother Name",
          "parent_id": "8",
          "relation_type": "mother",
          "children": [

          ]
        }
      ]
    }
  ]
}

POJO class

public class Tree {
    @SerializedName("data")
    @Expose
    public ArrayList<Child> data = null;

    public class Child {
        @SerializedName("family_id")
        @Expose
        public int family_id;
        @SerializedName("name")
        @Expose
        public String name;
        @SerializedName("relation_type")
        @Expose
        public String relation_type;
        @SerializedName("parent_id")
        @Expose
        public int parentId;
        @SerializedName("children")
        @Expose
        public List<Child> children = null;

        public int getId() {
            return family_id;
        }

        public void setId(int id) {
            this.family_id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getParentId() {
            return parentId;
        }

        public void setParentId(int parentId) {
            this.parentId = parentId;
        }

        public List<Child> getChildren() {
            return children;
        }

        public void setChildren(List<Child> children) {
            this.children = children;
        }
    }
}

As you can see Child class contains a List of its own so I am unable to identify how many records this list will contain

Hope it clears my problem any help will be appreciated. Thanks in advance

I have a CNN model which takes an image as input and predicts the class of the image, is there any way of creating an android app for this program, preferably on Android Studio.

This question already has an answer here:

I have my database on Cloud Firestore. The data is read-only. And the client application is an Android App written in Kotlin.

My database is something like this:

collection{courses}
    document{doc1}
        name: "csn206"
        ...
        ...
    document{doc2}
        name: "csn207"
        ...
        ...
    document{doc3}
        name: "csn301"
        ...
        ...    

I am trying to access my data in this way:

val db = FirebaseFirestore.getInstance().collection("courses")
db
    .get()
    .addOnCompleteListener{
        // display list of documents
    }

But, this downloads everything. I want reduce the unnecessary usage of Internet.

So, what I want to do is display name values of all documents in a list. And select the documents which are needed to be downloaded completely.

So, my question is how to get list of all documents' name values, without getting all of the documents?

I’ve been working on an app there are multiple dependencies mainly firebase. All are working fine but when I add the Admob dependency('com.google.android.gms:play-services-ads:17.2.0') it gives an error showing ‘com.google.android.gms.common.internal.zzg’.Tried many solutions from the blogs no success yet. If anyone could help me through it?