activity

Android 6.0 multiple permissions

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know that Android 6.0 has new permissions and I know I can call them with something like this if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSION_WRITE_STORAGE); } Today I saw a Google app which needs 3 permissions: contacts, sms and camera. It's making a page 1-3 and calls them all together at the same time to activate. Can anybody tell me how I can call

Static Value Android Studio

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have two Activities. And a static integer called as counter. So if I press a button in activity ' A ' then counter = counter + 1 . Here is the code from activity a: public static int counter = 0; cmdOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter = counter + 1; if (counter == 5) { tagihan.txtShip1.setTextColor(Color.parseColor("#000000")); tagihan.txtNilai1.setTextColor(Color.parseColor("#000000")); tagihan.txtSupir1.setTextColor(Color.parseColor("#000000")); } } And here it is from

Android M Permissions: onRequestPermissionsResult() not being called

匿名 (未验证) 提交于 2019-12-03 01:40:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm updating our app to use the new M Permissions system. It is all working besides the onRequestPermissionsResult(). I need to check a permission on a button press, and if it is successful, send a text message. When I grant permission to do it, the dialog closes, but it doesn't trigger the Send Text until I press the button again. I've debugged and set breakpoints in the onRequestPermissionsResult() method but it never goes into it. This method gets called first: private void askForPermission () { String [] permissions = new

Live Bytes vs Real Memory in Activity Monitor on iOS

匿名 (未验证) 提交于 2019-12-03 01:40:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm working on an iOS app that will create a lot of small objects and floats, and trying to get an idea for how much memory usage it's consuming. When I run the "Allocations" instrument, it says I have about 2MB of "Live Bytes", and the figure stays roughly constant as I move through the app (spikes up to 3MB or so when the App is busy, but then drops back down to 2MB). But when I run the "Activity Monitory" instrument, my app's "Real Memory" is 25MB once it finishes launching, and grows rapidly whenever drawing occurs inside my CALayer. In

Constraint Layout - Group visibility is not working inside dynamic module

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Has anyone experienced issues with ConstraintLayout group visibility? I'm using ConstraintLayout 1.1.3 and I'm setting the visibility of group in both XML layout and java code. But it does not change the visibility status. It is always visible. This is the layout file <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.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_width="match_parent"

using findviewbyid in a class that does NOT extend Activity in android

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a class that is currently extending Activity and I have methods like findViewById, ArrayAdapter etc. I want to turn it into an independent class but all the above methods become undefined. What is the problem? Shouldn't importing the classes be enough? For eg, I import android.view.View for findViewById but it still makes no difference. Please advise. 回答1: you should pass the instance of your Activity to your Second Class on the constructor like this : In your Activity Instanciate your Class like this : MyClass instance =

Android Fragment onAttach() deprecated

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have updated my app to use the latest support library (version 23.0.0), I've found out that they deprecated the onAttach() function of the Fragment class. Instead of: onAttach ( Activity activity ) It's now: onAttach ( Context context ) As my app uses the activity passed before deprecation, a possible solution i think is: @Override public void onAttach ( Context context ) { super . onAttach ( context ); activity = getActivity (); } Would that be the correct way to do it? UPDATE: If i run a device with API lower than 23, the new

Reverse Changset of an activity in Clearcase

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a requirement posted by the development team to reverse all changes in a given UCM activity. Constraint being we do not have delete rights. Meaning I know I can do a lsactivity to list all elements in an activity with their respective versions and then in the easy world would be able to delete those versions. But the SCM policy does not permit us to delete/ rmver anything. So I am left with back merging 1 version back. Meaning let us say I have version 5 of a.java checked into an activity. One way I think to achieve this, is find

Setting android:hardwareAccelerated=“true” in &lt;activity&gt; or in &lt;application&gt;

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want my app, which relies heavily on GPU, to use hardware acceleration. On some forums I've been suggested to set android:hardwareAccelerated="true" inside <application> and on other forums same attribute inside <activity> inside my AndroidManifest.xml . Below is the representation of what it looks like: <application ... android:hardwareAccelerated="true" ...> <activity ... android:hardwareAccelerated="true" ...> </activity> </application> I ended up setting in both, yet I wonder, which one is the right way, and what is the difference? 回答1

[Android] Activity页面切换效果

与世无争的帅哥 提交于 2019-12-03 01:38:24
大家使用Android的原生UI都知道,Android的Activity跳转就是很生硬的切换界面。其实Android的Activity跳转可以设置各种动画。 通常,对Activity切换时加入过渡动画的方法是: 在 startActivity() 或 finish() ,加入以下这个方法 overridePendingTransition(enterAnim, exitAnim); 实现非常简单,用overridePendingtransition(int inId, int outId)即可实现。inId是下一界面进入效果的xml文件的id,outId是当前界面退出效果的xml文件id。 样例代码可从 http://iaiai.iteye.com/blog/1078318 下载 来源: oschina 链接: https://my.oschina.net/u/242041/blog/203661