kotlin

Code for sending ArrayAdapter to another activity?

混江龙づ霸主 提交于 2021-02-02 09:56:58
问题 As we can send String type to another activity like this public static final String EXTRA_MESSAGE = "com.example.android.twoactivities.extra.MESSAGE"; what should be the code for this private static final ArrayAdapter LIST_OF_CUSTOMERS = P.S.- I am writing this code in MainActivity and want to send Database in the form of ListView to another activity named saveScreen 回答1: My first suggestion would be why cant the second activity simply query the database itself? Other then that if you must I

Drop un-needed decimal “.0”

心不动则不痛 提交于 2021-02-02 09:54:25
问题 I'm making a simple calculator and I am having an issue with it showing a decimal on what I want to just be a whole number. For example, if the entered expression is "50 + 50" the answer will come out "100.0". I understand that it's happening because my output is set as a double, but I can't figure out how to convert those numbers to integer only when the answer is ".0". My output answer code: fun equal (view: View) { secondnum = editText.text.toString() decpressed = 0 var sum = 0.0 when (op)

Code for sending ArrayAdapter to another activity?

北城余情 提交于 2021-02-02 09:52:32
问题 As we can send String type to another activity like this public static final String EXTRA_MESSAGE = "com.example.android.twoactivities.extra.MESSAGE"; what should be the code for this private static final ArrayAdapter LIST_OF_CUSTOMERS = P.S.- I am writing this code in MainActivity and want to send Database in the form of ListView to another activity named saveScreen 回答1: My first suggestion would be why cant the second activity simply query the database itself? Other then that if you must I

Android开发者进阶之路

无人久伴 提交于 2021-02-02 05:58:48
毫无疑问,移动开发时代的风口正在消退,AI风口正在来临。 2019年说是裁员元年一点也不为过。 我们看看大公司是如何裁员的:  华为:放弃平庸员工。  腾讯:结构性优化。  百度:鼓励狼性,淘汰小资。  蔚来:局部优化,提高运营效率。  科大讯飞:提前吃饭的员工需要被优化。  京东:淘汰掉因身体原因不能拼搏的员工。  马云:未来每年将会向社会输出1000名在阿里工作10年以上的人才。 都是裁员,马老师说的就是那么有大局观。 每一个说工作难找的都是半桶水的人,我们通过招聘网站看到高级的移动开发还是很抢手的。其实被裁的大多数都是入门级别的、或者中低级别的工程师,当然也有部分是因为整个公司崩溃掉的。 从某种意义上来说裁员这是整个行业不断规范化,社会发展优胜略汰的必然结果,不单单是移动端,不单单是互联网。 35岁的职业危机 做互联网的人都害怕35岁的职业危机,害怕某天就莫名其妙被优化掉。因为这个行业的变化实在太快了。快到什么程度? 比尔盖茨说:微软离破产只有三个月 为什么大家都说程序员是吃青春饭的职业呢? 所有程序员都知道互联网是一个争分夺秒,以时间为战场的战争,是一个不断在试错中探索前进的行业。因而这个行业的工作强度非常大,但是人的生理和智能的最高峰是20岁~30岁这个年龄段。过了30岁,身体就慢慢走下坡路了,思维也不如以前活跃了。特别是到了35岁,很多人都已经成家甚至有小孩了

Android Studio can't find Kotlin dependency

爷,独闯天下 提交于 2021-01-31 07:21:39
问题 I was trying to upgrade some dependencies for my Android Studio project and now I'm stuck with this error message whenever I try to build the project: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > Could not resolve all task dependencies for configuration ':app:debugAnnotationProcessorClasspath'. > Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25. Searched in the following locations: - https://dl.google.com/dl/android/maven2/org/jetbrains

重磅!印度封禁59款中国APP!微信抖音微博均在列!

大憨熊 提交于 2021-01-30 13:48:52
点击上方“ 技术最TOP ”,星标公众号 重磅干货,第一时间送达 技术最TOP 扒最前沿科技动态,聊最TOP编程技术。 关注 昨夜,印度政府突然宣布将禁用59个应用,虽然公告没有明确此次行动针对中国企业,但遭到禁止的应用绝大部分为中国互联网企业所开发,包括Tiktok、微信、快手、百度地图、QQ音乐等诸多中国用户熟知的应用。 禁用这些应用的原因是它们“参与了损害印度主权和领土完整、国防、国家安全以及公共秩序的活动”。 这并不是印度的突然袭击,印度情报机构早前已经向政府请求封禁一批应用。这批名单中的53个疑似和中国有关,大部分和昨晚的名单一致,但线上会议软件Zoom、小米商店Mi Store等早前在列的应用,并未出现在29日的最终名单中。 01 深夜突发,印度封禁59款中国APP 在印度政府发布的公告里,重点提及此次针对移动应用的行动,是基于“国家安全”。公告认为, 被禁止的应用在收集用户数据方面没有符合有关规定。 印度采取行动的法律依据是什么呢?印度的信息技术部声称根据2000年《信息技术法》第69A条以及《2009年信息技术(阻止公众获取信息的程序和保障措施)规则》的相关规定来进行禁止的。 信息技术部称,“已经收到来自各种来源的许多投诉,其中包括关于滥用某些App的报道,这些信息是盗用并以未经授权的方式秘密地将用户数据传输到印度以外的服务器”,“电脑紧急应变小组(CERT-IN

Why doesn't change the color of BottomNavigationView?

点点圈 提交于 2021-01-29 22:00:35
问题 So, my problem is that, when I change the theme in the application, it works well on all the fragments, except in the MainActivity BottomNavigationView. I think it isn't use the dark theme colors, just use only the light theme colors, and I don't know why. I tried some solutions from Stackoverflow but I can't figure up what's wrong. This is my MainActivity xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/container" android:layout_width="match_parent" android:layout_height=

Pass data from adapter to activity using interface callback method with Kotlin

折月煮酒 提交于 2021-01-29 21:49:31
问题 I have read through this Kotiln: pass data from adapter to activity and am attempting option 1 from the answer given. I have a game with various levels. I send all levels to a recycler view using the the below itemview in gridlayout <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.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

ViewPager2 adapters - difference between FragmentActivity / Fragment / FragmentManager

让人想犯罪 __ 提交于 2021-01-29 21:15:53
问题 I noticed in this ViewPager2 video that there are 3 different ways of declaring an adapter with Fragment s. What's the difference between them and which 1 should be used for swipe views with tabs using ViewPager2? Option 1 (recommended) class MyFragmentAdapter ( fa: FragmentActivity ) : FragmentStateAdapter(fa) Option 2 class MyFragmentAdapter ( f: Fragment ) : FragmentStateAdapter(f) Option 3 class MyFragmentAdapter ( fm: FragmentManager, l: Lifecycle ) : FragmentStateAdapter(fm, l) 回答1:

Accessing ViewModel in ParentFragment from ChildFragment using viewModels

时光怂恿深爱的人放手 提交于 2021-01-29 20:30:27
问题 I am trying to access the ParentViewModel for ParentFragment from ChildFragment using viewModels . This is my code. // In ParentFragment class ParentFragment : Fragment() { val parentViewModel: ParentViewModel by viewModels { ParentViewModelFactory(getRepository()) } ... } // In ChildFragment class ChildFragment : Fragment() { val parentViewModel: ParentViewModel by viewModels( { requireParentFragment() } ) ... } However, this code only works when I setup a LiveData variable in