• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help!: What wrong with this code?

I am a newbie to coding with Android Studio / Korlin.
To get started I am trying to build a simple app that give a Treeview of the internal storage of the device its run on (In the AVD I am using a Pixel 6 Pro - 34.

The below code build and I can create the APK and deploy it, but opening it, it closes instantly.
This is starter code which I will look to build upon once I have a running starting point, but as youll see, that isnt what I presently have (LOL)

MainActivity.KT:

package com.example.treeview

import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView

import android.content.Context
import android.os.Bundle
import android.os.Environment
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast

import java.io.File
import java.util.ArrayList

class TreeViewActivity : AppCompatActivity() {
private lateinit var recyclerView: RecyclerView
private lateinit var files: MutableList<File>

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

recyclerView = findViewById(R.id.recycler_view)
recyclerView.layoutManager = LinearLayoutManager(this)

files = ArrayList()

// Get all files from internal storage
val internalStorage = Environment.getExternalStorageDirectory()
val allFiles = internalStorage.listFiles()
for (file in allFiles) {
if (file.isDirectory()) {
files.add(file)
}
}

// Create a TreeViewAdapter and set it to the RecyclerView
val adapter = TreeViewAdapter(this, files)
recyclerView.adapter = adapter
}

class TreeViewAdapter(private val context: Context, private val files: MutableList<File>) :
RecyclerView.Adapter<TreeViewAdapter.ViewHolder>() {

private val inflater = LayoutInflater.from(context)

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = inflater.inflate(R.layout.item_file, parent, false)
return ViewHolder(view)
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val file = files[position]
holder.textView.text = file.name

// Check if the file is a directory
if (file.isDirectory()) {
holder.imageView.setImageResource(R.drawable.fileinfolder)
} else {
holder.imageView.setImageResource(R.drawable.files)
}

holder.itemView.setOnClickListener {
// Do something when the file is clicked
Toast.makeText(context, "File clicked: " + file.name, Toast.LENGTH_SHORT).show()
}
}

override fun getItemCount(): Int = files.size

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val textView: TextView = itemView.findViewById(R.id.text_view)
val imageView: ImageView = itemView.findViewById(R.id.image_view)
}
}
}

Activity_Tree_View.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />

<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@String/no_files_found"
android:visibility="gone" />

</LinearLayout>


Item_file.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />

<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@String/no_files_found"
android:visibility="gone" />

</LinearLayout>


Build.Gradle (App):

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
namespace 'com.example.treeview'
compileSdk 33

defaultConfig {
applicationId "com.example.treeview"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.3.2'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.10.1'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.activity:activity-compose:1.7.2'
implementation platform('androidx.compose:compose-orlin:2022.10.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
}


Anyone that can help get this to actually run on the AVD I would be very appreciative...

Bill

Best similar / closest to Samsung Galaxy Note 8 apps

XWidget also has a ton of the Samsung widgets (I am not sure if they ever updated to fix the bug in Android 12+ where the widgets stop refreshing though).

Samsung Internet and Samsung Notes will install on any phone, not just Samsungs. Samsung Health also works on non-Samsung phones. You won't get Messages, Gallery, Contacts, Phone Dialer or the like as those depend on specific OneUI APIs that don't exist on another phone. You can possibly find alternatives that are similar, but like my attempt at "Samsung-ifying" my Nexus 6, you'll end up with a half done attempt that won't ever feel right or complete.

I am not sure why you didn't choose another Samsung phone, such as one of the A-series, as they're cheap, work well and have the same UI design.

[APP] Mountain Landscape Wallpaper - the best live wallpaper 2023?

Mountain Landscape Wallpaper

ic_launcher_msc_free.png
Experience the breathtaking beauty of live wallpapers that bring stunning mountain landscapes to life on your screen.

msc_free_1024_500_2.jpg

Mountain Landscape Live Wallpapers immerse you in the serene beauty of heavenly landscapes, where the grandeur of mountains and the depth of lakes blend in perfect harmony. Enjoy the captivating beauty of nature with Mountain Landscape Live Wallpapers.

msc_phone_rotate.jpg

Feel the tranquility of this idyllic spectacle, where majestic pink sakura delicately hangs over picturesque lakes, creating a sense of serenity and peace.

msc_phone_1.jpg

Now, with the Mountain Landscape Live Wallpapers app, you can meditate anywhere and anytime, combining the pleasure of observing enchanting mountain landscapes with the soothing sounds of nature (quick double-tap anywhere on the screen to play/pause the sound).

msc_phone_sound.jpg

The automatic day and night mode system allows you to enjoy the app at dawn, noon, in the radiance of sunset, and at any time of the day as the lighting changes.

msc_phone_2.jpg

Key Features:
• Detailed customization options
• Automatic background change over time
• Nature sounds and nightingale's melody (quick double-tap to toggle sound playback)
• Animated sky, clouds, and rainbow
• Dynamic reflection of the sky in lakes
• Moving 3D camera (tilt your device for a 3D effect)
• Animated butterflies
• Large air balloons
• Shimmering stars and meteors
• Battery-efficient performance
• High-quality textures
• 3D parallax effect
• Three types of animated birds


Immerse yourself in the beauty of mountain landscapes with Mountain Landscape Live Wallpapers. Let this app turn your device into a window to the magnificent world of mountains and lakes. Allow yourself to enjoy the glitter, shine, and beauty of live wallpapers wherever you are.


Problem with APK file

Please ignore this post. The problem seems to have gone away.
but I can’t find a way to delete it.

Noobie here. I installed Android Studio flamingo and followed a couple of tutorials on youtube. My latest effort involves experimenting with the Recyclerview. I have tried running it on a couple of different virtual devices and it runs OK until I try to launch the activity that has the Recyclerview. Then I get this error:

Failed to measure fs-verity, errno 1: /data/app/~~pmpCKyqulePUBHTy7ke96g==/com.example.recyclerdemo-480zG4iexej-Wk4snRDEjQ==/base.apk

So far I have not been able to find enough info about APK files to even know where to look.

Can someone help please? Much appreciated.

Flashed wrong twrp file

While trying to root my samsung galaxy j7 ,I flashed other devices twrp file using odin3 then when I pressed volup+home+power its not going forward and not showing twrp logo.Then I tried to flash correct twrp file using odin ,it is failing to do so.What shoul I do now .
like @Brian706 mentioned you will need to try and flash a samsung firmware. you need to go to Download firmware updates for your Samsung mobile phone and tablet and get the correct firmware that is specifically for your device. dont make the same mistake though. flashing the wrong firmware can screw the phone up even more. you will need odin to flash the firmware. details on how to flash it will be in the download part of the site.

once you have a working phone then you can try again using the correct twrp for your phone.

edit: what is your phone's model number?

ecoATM

There's about three of those EcoATMs here in various places, two at Walmarts and another in our dying mall. All three are dead/broken. The two at the Walmarts fail sometime during the 'evaluation phase' and give up, the one at the mall got vandalized, someone busted the LCD and cut the cables out. It's still there but obviously out of order. I've heard of folks buying phones from them but never saw that option on the ones at Walmart.

They get negative reviews online for giving very little for even a modern phone. I think TechRax from YouTube destruction fame tried to see what it'd give for an iPhone X and Xs Max back when those were the newest thing, and I think $150 was the most he could get. The UI is horrendous and features this goofy robot avatar who spouts off noob instructions and 'facts' that are not even current, such as referencing the phone from Saved by the Bell.

Locked out of phone, lock screen has strange icon

If this was indeed after a system update (which reboots the phone) it will require your PIN on a restart. If you forgot it that sucks and you have to reset it. Although the PIN is also enforced after 72 hours (if using a fingerprint sensor) so forgetting it is sorta odd and should only happen if you made it needlessly complicated (like that string of numbers from a particular Star Trek: The Next Generation episode)

Here we go with another vacuum cleaner question

Kirby are super cheap secondhand. Even a more modern one. I swear soon as they show up at vendor malls or Goodwills they're selling for $49! Sometimes you get lucky and the box of attachments is duct taped to the vacuum.

Electrolux still exists?! I haven't seen them since the rather high-tech model we once had (from 1984 with tons of indicator lights) got taken apart by myself when I was little and a bit too curious.

Android Security Tips

I once had to install that monstrosity on a laptop to allow me to play Flash content (namely, FarmVille and Gardens of Time--their respective iOS and Android apps had long since stopped working) after another corporation decided to up and kill it. It was a slow, unstable mess. Didn't help I was attempting to run it on a Vista machine with only 2GB RAM, but obviously it was too much for the specs of that system. I was able to at least SEE Gardens of Time and play a couple levels (had to restart from level one sadly) before it failed to work thereafter. There are two games called 'Gardens of Time' today, and the one that shows up on a modern device is not the same game. The one I remember was set in the Victorian era and was a Facebook game at one time, similar to FarmVille. I forget the developer, but Disney had rights to it for a while. That game no longer shows up on a search, only a game with the same name that has nothing in common. I miss that game personally. Like FarmVille, it died with the death of Flash, and the death is so involved that even installing an older copy on Windows Vista can't bring it back. Can't use any of the self-contained players either because those games depend on their internet servers. I wonder how NewGrounds is coping?

Googoo play services

Clearing cache won't hurt anything. It just deletes any stored content (sometimes this includes downloads from YouTube Music, and downloaded maps from Maps as well) but it might use more battery to redownload anything it was keeping track of before you cleared it. Google Play Services always seems to run in the background to enable things such as prefetching map data, location history, commonly accessed browser sites, server-side app updates (the very thing that enforces the 'modern' UI on the oldest version of Google Maps on my Galaxy S4 for one example---despite never having updated the app itself), and many more.

It's sorta like killing apps. It won't net any real benefits. Clearing cache (and the more involved 'clearing dalvik cache' in recovery) is an obsolete thing today.

You can sometimes bypass or tap out of any 'error' that says you NEED Play Services (and turn the notification off) and still run apps such as Google Chrome or some other third-party app that somehow thinks it needs it. The only negatives I've dealt with involved paid apps assuming they're no longer paid and won't open, or in-app purchases disappearing (if you paid via in-app purchase for the 'no ads' option in some apps), and Pokemon Go and Vi AI Personal Trainer no longer getting their required location data and breaking.

The more positive side-effect is that at one time YouTube would run in no-ad mode since it depended on Play Services to get ad data (this was in the Jelly Bean era) and Wheel of Fortune game giving free otherwise paid content without it (both produced errors demanding you needed it but tapping out of the box with the error bypassed it and you could run anyway). I'm sure those are both patched now.

Root HOW TO ROOT SAMSUNG GALAXY S23 ULTRA WITH MAGISK

Some people seem to want to root for no other reason than to root... that makes no sense to me. The user assumes all the risks involved, including turning their VERY expensive device into a paperweight (aka "brick"). Unless there's a really good, compelling reason to gain root access on my device, Android is mature enough to provide no such reasons. I purchase my phones factory unlocked and can use any network I want. If an app isn't available in Play Store, I sideload the apk. Everything I need/want my phone to do, it does.

Mountain Landscape Wallpaper

Mountain Landscape Wallpaper


ic_launcher_msc_free.png
Experience the breathtaking beauty of live wallpapers that bring stunning mountain landscapes to life on your screen.


msc_free_1024_500_2.jpg

Mountain Landscape Live Wallpapers immerse you in the serene beauty of heavenly landscapes, where the grandeur of mountains and the depth of lakes blend in perfect harmony. Enjoy the captivating beauty of nature with Mountain Landscape Live Wallpapers.

msc_phone_rotate.jpg

Feel the tranquility of this idyllic spectacle, where majestic pink sakura delicately hangs over picturesque lakes, creating a sense of serenity and peace.


msc_phone_1.jpg

Now, with the Mountain Landscape Live Wallpapers app, you can meditate anywhere and anytime, combining the pleasure of observing enchanting mountain landscapes with the soothing sounds of nature (quick double-tap anywhere on the screen to play/pause the sound).

msc_phone_sound.jpg

The automatic day and night mode system allows you to enjoy the app at dawn, noon, in the radiance of sunset, and at any time of the day as the lighting changes.

msc_phone_2.jpg

Key Features:
• Detailed customization options
• Automatic background change over time
• Nature sounds and nightingale's melody (quick double-tap to toggle sound playback)
• Animated sky, clouds, and rainbow
• Dynamic reflection of the sky in lakes
• Moving 3D camera (tilt your device for a 3D effect)
• Animated butterflies
• Large air balloons
• Shimmering stars and meteors
• Battery-efficient performance
• High-quality textures
• 3D parallax effect
• Three types of animated birds


Immerse yourself in the beauty of mountain landscapes with Mountain Landscape Live Wallpapers. Let this app turn your device into a window to the magnificent world of mountains and lakes. Allow yourself to enjoy the glitter, shine, and beauty of live wallpapers wherever you are.


Filter

Back
Top Bottom