android-studio

How to call getPackageManager() from Android command-line executable

£可爱£侵袭症+ 提交于 2020-01-16 11:16:04
问题 I am writing a command-line tool for Android (such that it would be called via 'adb shell' or the like, as opposed to being launched via the Android interface). I want to write something that uses the same kind of information as the 'pm list packages' tool that you can run from an adb shell, which I presume uses getPackageManager() or something like it. So I've figured out how to compile and run a Java tool in Dalvik, but I can't figure out how to get it the context it needs for

How do I make my ScrollView dynamically change when adding lines to my EditText?

好久不见. 提交于 2020-01-16 11:15:07
问题 https://gyazo.com/1940054eacbe2e3388ac9e6da0eb2cb1 I have a linear layout, nested in a relative layout, nested in a scrollview. When I add lines to my EditText the scroll bar doesn't dynamically update, it still acts as if it's at the top of the page. I have set the fillViewport of my ScrollViews to true, I have changed every imaginable component's height constraints to every possible variation of constraint. Any ideas would be great, thanks 回答1: It is happening because of soft-keyboard.Add

android - how to declare a widget from another layout?

你说的曾经没有我的故事 提交于 2020-01-16 11:06:24
问题 I have a fragment layout that contains a class, but it needs to edit an imageview that is in another layout fragment. Example: public class LayoutFragment extends Fragment { private ImageView imageView; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_layout, container, false); imageView = view.findViewById(R.id.imageView); // this imageview is not fragment_layout, he is in fragment_layout2

android - how to declare a widget from another layout?

不羁的心 提交于 2020-01-16 11:06:09
问题 I have a fragment layout that contains a class, but it needs to edit an imageview that is in another layout fragment. Example: public class LayoutFragment extends Fragment { private ImageView imageView; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_layout, container, false); imageView = view.findViewById(R.id.imageView); // this imageview is not fragment_layout, he is in fragment_layout2

Bottom Navigation View With Navigation Control transaction failing some times

耗尽温柔 提交于 2020-01-16 09:03:12
问题 while moving from one tab to another tab on bottom navigation view some times i am getting the app theme color is applying to enter fragment like this is my code ``code from activity``` override fun onSupportNavigateUp() = NavigationUI.navigateUp(navController!!, null) private fun setUpNavigation() { navController = Navigation.findNavController(this, R.id.frameRoot) bottomNavigationView.setupWithNavController(navController) bottomNavigationView.setOnNavigationItemSelectedListener { item ->

webview doesn't open some sites in recent versions of android

血红的双手。 提交于 2020-01-16 08:41:12
问题 I have an app that open a webview and I found that I can't open some sites in recent versions of android. Before I got the error Page not found but I was searching and I found this link where it say: android:usesCleartextTraffic Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP. The default value for apps that target API level 27 or lower is "true". Apps that target API level 28 or higher default to "false". ... So I add android:usesCleartextTraffic=

webview doesn't open some sites in recent versions of android

妖精的绣舞 提交于 2020-01-16 08:41:09
问题 I have an app that open a webview and I found that I can't open some sites in recent versions of android. Before I got the error Page not found but I was searching and I found this link where it say: android:usesCleartextTraffic Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP. The default value for apps that target API level 27 or lower is "true". Apps that target API level 28 or higher default to "false". ... So I add android:usesCleartextTraffic=

unable to load import android.support.design.widget.BottomNavigationView; on android studio

本秂侑毒 提交于 2020-01-16 08:36:07
问题 I want to make navigation view from this tutorial tutor but I found a problem cannot resolve design ive read a lot similar question from stack overflow but that doesnt help me, ive tried to invaled chaces/restartd ive treid to rescyn gradle ive treid to delet libraries inside .idea still not work heres my gradle android { compileSdkVersion 28 defaultConfig { applicationId "com.example.lordbramasta.praktikum" minSdkVersion 16 targetSdkVersion 28 versionCode 1 versionName "1.0"

NullPointerExcepter Error when using List Adapter and Custom List View in Android Studio

浪尽此生 提交于 2020-01-16 07:18:05
问题 Been trying to write an app in android studio. Part of the app has to parse a document in JSON and display two TextViews of data for each instance. One being Signal and the other being Noise. I am trying to make a custom list view in case I want to add more detail to each instance. I also would like to make it all contained in a ScrollView. I initially had no problems parsing the document but now that I am trying to implement the ListAdapter I am running into issues. My code is giving me the

RxAndroid `Observable…subscribe` highlighted in Android Studio

社会主义新天地 提交于 2020-01-16 06:07:10
问题 I'm using RxAndroid to marshal a string from a background thread into the main thread, and do something with that string on that main thread: String stringFromDatabase = readFromDatabase(); Observable.just(stringFromDatabase) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer<String>() { @Override public void accept(String string) throws Exception { webViewFragment.onInjectMessage(string, null); } }); Android Studio is highlighting the entire Observable.just... command chain