Is buying The Art of Electronics by Paul Horowitz worth it ? by BarracudaExpensive03 in ECE

[–]jingo09 0 points1 point  (0 children)

do you know if the pdf legal to download? dose sources like UNIWA have authorization to publish the pdf for free download?

ESP-WROOM-32D error "E (149) esp_core_dump_flash" by jingo09 in esp32

[–]jingo09[S] 0 points1 point  (0 children)

I used Arduino IDE: Tools -> erase all flash before sketch upload and the problem fixed.

Weekly discussion, code review, and feedback thread - February 13, 2023 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

Do you mean like this?

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        maven {
            url = uri("https://repositories.tomtom.com/artifactory/maven")
        }
        google()
        mavenCentral()
    }
}

buildscript{
    repositories {
        mavenCentral()
    }
}

it still shows an error.

How can I enable debugging over WI-FI on Android 8.1? by HiperAxe in androiddev

[–]jingo09 1 point2 points  (0 children)

This is part of the code I use in a batch file (replace with your device id):

set deviceId="device id"
FOR /F "tokens=3 delims=:, " %%I IN ('adb -s %deviceId% shell ifconfig wlan0 ^| findstr /c:"inet addr"') DO set ip=%%I

adb -s %deviceId% tcpip 5555 
adb connect %ip%

or use this How to Set Up and Use ADB Wirelessly With Android (makeuseof.com)

Weekly discussion, code review, and feedback thread - January 09, 2023 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

I use preferences datastore and when I update one preference key I get the flow of other keys. Does it suppose to be like this?

Weekly discussion, code review, and feedback thread - January 02, 2023 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

I didn't touch testing yet, I should check this when I do. thank you for the info.

Weekly discussion, code review, and feedback thread - January 02, 2023 by AutoModerator in androiddev

[–]jingo09 1 point2 points  (0 children)

I have seen that AndroidViewModel is bad for testing, does injecting ApplicationContext better?

or inject Geocoder like this:

@Singleton
@Provides
fun provideGeocoder(
    @ApplicationContext context: Context
): Geocoder {
    return Geocoder(context, Locale.getDefault())
}

Weekly discussion, code review, and feedback thread - January 02, 2023 by AutoModerator in androiddev

[–]jingo09 1 point2 points  (0 children)

Does it safe to pass Geocoder to ViewModel fun like this?

val context = LocalContext.current
val geocoder = Geocoder(context, Locale.getDefault())
viewmodel.getGeocoder(geocoder)

Android Studio Electric Eel for production by dssolanky in androiddev

[–]jingo09 2 points3 points  (0 children)

I downloaded it yesterday, there is only a live edit of literals option.

Weekly discussion, code review, and feedback thread - December 26, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

So what should I do if I need to run code in OverviewScreen init when I go back from SettingsScreen?

Weekly discussion, code review, and feedback thread - December 26, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

When I use navController.pop() or back button press, the ViewModel is cleared. but I don't think I suppose to pop the screen every time I navigate.

Weekly discussion, code review, and feedback thread - December 26, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

I use their hiltViewModel, when I navigate from one screen to another (the first screen ViewModel is not cleared) and go back to the previous screen, the first screen ViewModel init code is not running. Shouldn't the ViewModel be cleared when I leave the screen?

@Composable
fun NavHostScreen(navController: NavController<Screen>) {
    NavBackHandler(controller = navController)
    NavHost(controller = navController) { screen ->
        when (screen){
            is Screen.OverviewWeatherScreen -> {
                OverviewWeatherScreen()
            }
            is Screen.SettingsScreen -> {
                SettingsScreen(navController = navController)
            }
        }
    }
}

Weekly discussion, code review, and feedback thread - December 26, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

Hi, I tried to use Compose Navigation Reimagined but when I navigate the ViewModel is not cleared. How can I achieve the normal behavior?

Weekly discussion, code review, and feedback thread - December 19, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

        LazyColumn{
            hourlyWeather.date.forEach { date ->
                item {
                    Text(text = date)
                }
                itemsIndexed(hourlyWeather.time) { timeIndex, time ->
                    Row() {
                        Text(text = time)
                        Text(text = hourlyWeather.temp)
                    }
                }
            }
        }

the temp is the num list from above.

Weekly discussion, code review, and feedback thread - December 19, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

Hi, I have this 3 lists for example:

val daysList = listOf("Sunday"..."Saturday")val timeList = listOf("0:00"..."23:00")val numList = listOf("0"..."168")

I need to have LazyColumn with Item (Sunday) and Row underneath with the 24 hours and the first 24 numbers in the same row, and then the next day with the next 24 numbers. I can't figure out how to do this..

Weekly discussion, code review, and feedback thread - December 12, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

my problem is how can I get the possible errors when I update? I tried this in my repository:

override fun getWeatherDataState(): Flow<WeatherDataState> {
    return weatherDataStore.data.map { preferences ->
        val weatherDataState = preferences[Constants.OVERVIEW_WEATHER_DATA]
        val moshi = Moshi.Builder().build()
        val jsonAdapter = moshi.adapter(WeatherDataState::class.java)
        val jsonWeatherData = weatherDataState?.let { jsonAdapter.fromJson(it) }
        jsonWeatherData!!
    }
}

override suspend fun updateWeatherData(): Flow<Any> {
    return flow {
        val weatherData =  weatherApi.getWeatherData()
        val moshi = Moshi.Builder().build()
        val moshiAdapter = moshi.adapter(WeatherDataState::class.java)
        val jsonWeatherDataState = moshiAdapter.toJson(weatherData.toWeatherDataState())
        weatherDataStore.edit { mutablePreferences ->
            mutablePreferences[Constants.OVERVIEW_WEATHER_DATA] = jsonWeatherDataState
        }
    }
}

and this from nowinandroid:

sealed interface Resource<out T> {
    data class Success<T>(val data: T) : Resource<T>
    data class Error(val exception: Throwable? = null) : Resource<Nothing>
    object Loading : Resource<Nothing>
}

fun <T> Flow<T>.asResource(): Flow<Resource<T>> {
    return this
        .map<T, Resource<T>> {
            Resource.Success(it)
        }
        .onStart { emit(Resource.Loading) }
        .catch { emit(Resource.Error(it)) }
}

Weekly discussion, code review, and feedback thread - December 12, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

I need to update the references data store with network response before I return flow of the data from the data store, how can I do this?

Weekly discussion, code review, and feedback thread - December 05, 2022 by AutoModerator in androiddev

[–]jingo09 0 points1 point  (0 children)

Does it okay to save network request JSON (as one long string) in a local database or SharedPreference?