activity

Get Current Activity in Espresso android

匿名 (未验证) 提交于 2019-12-03 01:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: In case of a test that crosses multiple activities, is there a way to get current activity? getActivtiy() method just gives one activity that was used to start the test. I tried something like below, public Activity getCurrentActivity () { Activity activity = null ; ActivityManager am = ( ActivityManager ) this . getActivity (). getSystemService ( Context . ACTIVITY_SERVICE ); List taskInfo = am . getRunningTasks ( 1 ); try { Class > myClass = taskInfo . get ( 0 ). topActivity . getClass (); activity = ( Activity ) myClass .

Force an Android activity to always use landscape mode

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using the Android VNC viewer on my HTC G1 . But for some reason, that application is always in landscape mode despite my G1 is in portrait mode. Since the Android VNC viewer is open source, I would like know how is it possible hard code an activity to be 'landscape'. I would like to change it to respect the phone orientation. 回答1: Looking at the AndroidManifest.xml ( link ), on line 9: This line specifies the screenOrientation as landscape, but author goes further in overriding any screen orientation changes with configChanges=

DialogFragment callback on orientation change

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm migrating my dialogs, currently using Activity.showDialog(DIALOG_ID); , to use the DialogFragment system as discussed in the android reference . There's a question that arose during my development when using callbacks to deliver some event back to the activity/fragment that opened the dialog: Here's some example code of a simple dialog: public class DialogTest extends DialogFragment { public interface DialogTestListener { public void onDialogPositiveClick(DialogFragment dialog); } // Use this instance of the interface to deliver action

creating base activity with navigation drawer in android

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I tried to follow this answer, with the main idea is to override the setContentView in the BaseActivity , the activity that will be extended by all activity so only BaseActivity will have the navigation drawer. However, my navigation is never shown (even in BaseActivity ) after i tried to implement the answer. This is what i did : This is the navigation drawer's xml : This is my overrided setContentView (in BaseActivity ) : @Override public void setContentView(int layoutResID) { // TODO Auto-generated method stub mDrawerLayout= (DrawerLayout

Too much work in main thread, app freezes

匿名 (未验证) 提交于 2019-12-03 01:13:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here I make call to an activity, which is a chat application. The catLog: 02-26 12:30:38.996: I/Choreographer(807): Skipped 35 frames! The application may be doing too much work on its main thread. 02-26 12:30:39.196: I/Choreographer(807): Skipped 31 frames! The application may be doing too much work on its main thread. 02-26 12:30:39.516: I/Choreographer(807): Skipped 31 frames! The application may be doing too much work on its main thread. 02-26 12:30:39.996: I/Choreographer(807): Skipped 32 frames! The application may be doing too much

Error type 3 Error: Activity class {} does not exist

匿名 (未验证) 提交于 2019-12-03 01:13:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an INTELIJ(v12) android project successfully imported to AndroidStudio(v0.4.0). It works perfectly if I don't change anything in manifest. When I want to change the launcher activity and run, it outputs with the following error: Launching application: com.trackingeng/LandingActivity. DEVICE SHELL COMMAND: am start -D -n "com.trackingeng/LandingActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.trackingeng

Error type 3 Error: Activity class {} does not exist

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an INTELIJ(v12) android project successfully imported to AndroidStudio(v0.4.0). It works perfectly if I don't change anything in manifest. When I want to change the launcher activity and run, it outputs with the following error: Launching application: com.trackingeng/LandingActivity. DEVICE SHELL COMMAND: am start -D -n "com.trackingeng/LandingActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.trackingeng

Cannot read packageName from AndroidManifest.xml

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have errors in my android manifest file: I tried to look on this website but the answers aren't working for me. <?xml version="1.0" encoding="utf-8"?> < manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.brandon.MineDodge" > <application android:allowBackup="true" android:icon="@mipmap/redjet" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.brandon.MineDodge.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name=

MVVM pattern and startActivity

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I recently decided to have a closer look at the new Android Architecture Components that Google released, especially using their ViewModel lifecycle-aware class to a MVVM architecture, and LiveData. As long as I'm dealing with a single Activity, or a single Fragment, everything is fine. However, I can't find a nice solution to handle Activity switching. Say, for the sake of a short example, that Activity A has a button to launch Activity B. Where would the startActivity() be handled? Following the MVVM pattern, the logic of the clickListener

Android crash on GooglePlayServices (Games) connect

匿名 (未验证) 提交于 2019-12-03 01:11:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm messing around with this problem about 10h and i cann't figure out what i've done wrong.... The Fatal Exception : E/AndroidRuntime: FATAL EXCEPTION: main Process: onl.deepspace.zoorallye, PID: 13256 java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information. at com.google.android.gms.common.internal.zzj$zza.zzc(Unknown Source) at com.google.android.gms.common.internal.zzj$zza.zzw(Unknown Source) at com.google.android.gms.common.internal.zzj$zzc.zzqN(Unknown Source) at com.google.android