Category : android

I am trying to call an API using Retrofit in an Android application using Kotlin. The API requires a a header and body similar to the following sample input: Sample Input Header: loginName: 65848614-6697-4cf7-a64a-e0b9374c4aee Body: clientId: DKOKTrykIQ987yQcLNehT8SWJRMyQLdP secret: 6Jt1ENlDn9gxPu5f The content type has to be passed as application/x-www-form-urlencoded. Currently, I am using the following classes: ..

Read more

I have been working on getting markers drawn from an sqlite database. So far i have gotten so far that the application displays the last marker from the database using a for loop but I am not sure how to display all the locations. My guess is that the applications goes through the for loop ..

Read more

I am showing a badge in a bottomNavigation menu item with this code: val customBadge = bottomNavigation.getOrCreateBadge(R.id.menu_item_id) customBadge.isVisible = true QUESTION: Instead using the default badges I would like to use a custom image that I imported as Drawable resource in my project R.drawable.custom_badge. customBadge.setDrawableBadge(R.drawable.custom_badge) fun setDrawableBadge(drawableResource: Int) { // Anyone knows how to implement ..

Read more

I got a layout that i want to make visible (which was "GONE" first) on clicking a button. <include android:id="@+id/registration_layout" layout="@layout/user_registration" android:visibility="gone"/> <include android:id="@+id/login_layout" layout="@layout/login" android:visibility="gone"/> Here is what i include in the xml file fun onClickLogin(view: View) { val login_layout = R.id.login_layout as Layout val registration_layout = R.id.login_layout as Layout login_layout.visibility = View.VISIBLE val ..

Read more

This might be a silly question: I have this code that opens an explorer for the user to choose a music file from their device: public class MainActivity extends AppCompatActivity { private Uri uri; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent fileIntent; // ACTION_GET_CONTENT doesn’t work except on API <= 18 if (android.os.Build.VERSION.SDK_INT ..

Read more

I have an AsyncTask, which shows a item list from external URL. private static class GetContacts extends AsyncTask<String, Void, List<Actors>> { ProgressDialog dialog; private final WeakReference<Search> activityReference; GetContacts(Search context) { activityReference = new WeakReference<>(context); } @Override protected void onPreExecute() { Search activity = activityReference.get(); if (activity == null || activity.isFinishing() || activity.isDestroyed()) return; super.onPreExecute(); dialog ..

Read more

Could it be because we have 2 different Firebase projects targeting the same package name? Production Firebase Staging We have 2 different google-services for 2 build variants. Of course I’ve checked that my 2 google-services.json files are up to date and are in the right folders This happened after we removed Fabric SDK and switch ..

Read more

as statet, i am trying to send an image from a Java server to an android client. The issue is, that the android client doesn’t seem to read it properly. Here’s the method from the Server: OutputStream outputStream = socket.getOutputStream(); BufferedImage image = ImageIO.read(new File("C:UsersFinn OleDesktoptest.png")); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ImageIO.write(image, "png", byteArrayOutputStream); byte[] ..

Read more