android-activity

Android App Close without Error, on click of the first gridview Item

南楼画角 提交于 2020-01-17 04:25:08
问题 i have a fragment which displays a gridview with images. @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.hotelgallery, container, false); gridView = (GridView) v.findViewById(R.id.gridView); gridAdapter = new GridViewAdapter(getActivity(), R.layout.grid_item_layout, getData(getActivity())); gridView.setAdapter(gridAdapter); gridView.setOnItemClickListener(new

Unable to start new Activity:android

折月煮酒 提交于 2020-01-17 04:23:06
问题 I have added a new activity through right clicking on app. New >Activity >Navigation Drawer Activity . http://i.stack.imgur.com/Pdtbo.png Now i am not able to start this activity from MainActivity . And getting following errors. Please help me. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.atlasmobile/com.app.atlasmobile.Pois_main}: android.view.InflateException: Binary XML file line #19: Error inflating class fragment at android.app.ActivityThread

Android finishActivity always causing onActivityResult to get RESULT_CANCELED

心已入冬 提交于 2020-01-17 00:44:54
问题 I have a main Activity A that can kick off sub-Activities B, C, or D. I start them using startActivityForResult(newIntent, REQUEST_CODE); The user can choose to navigate between B, C, and D once one is displayed. Activity A controls that navigation. When they choose swap between screens 'A' first calls finishActivity(REQUEST_CODE); on the one displayed and then call startActivityForResult(newIntent, REQUEST_CODE); for the next one. In my onActivityResult I've got protected void

Android finishActivity always causing onActivityResult to get RESULT_CANCELED

雨燕双飞 提交于 2020-01-17 00:43:29
问题 I have a main Activity A that can kick off sub-Activities B, C, or D. I start them using startActivityForResult(newIntent, REQUEST_CODE); The user can choose to navigate between B, C, and D once one is displayed. Activity A controls that navigation. When they choose swap between screens 'A' first calls finishActivity(REQUEST_CODE); on the one displayed and then call startActivityForResult(newIntent, REQUEST_CODE); for the next one. In my onActivityResult I've got protected void

Activity restart on rotation Android

瘦欲@ 提交于 2020-01-16 19:31:34
问题 In my Android application, when I rotate the device (slide out the keyboard) then my Activity is restarted ( onCreate is called). Now, this is probably how it's supposed to be, but I do a lot of initial setting up in the onCreate method, so I need either: Put all the initial setting up in another function so it's not all lost on device rotation or Make it so onCreate is not called again and the layout just adjusts or Limit the app to just portrait so that onCreate is not called. 回答1: Using

AlarmManager Does not work when Activity in background

孤者浪人 提交于 2020-01-16 18:35:32
问题 In my App, I'm using AlarmManager for transmitting keep-alive every day once a day. I'm using the following code for starting athe AlaramManager Calendar calendar = DateUtils .getNextKeepAliveTime(keepAliveHours, keepAliveMinutes); Intent intent = new Intent(this, AlarmReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(getApplicationContext(), ALARM_REQUEST_CODE, intent, 0); // PendingIntent.FLAG_UPDATE_CURRENT); // Get the AlarmManager service Log.d(TAG, "cal: " + calendar

AlarmManager Does not work when Activity in background

北慕城南 提交于 2020-01-16 18:35:09
问题 In my App, I'm using AlarmManager for transmitting keep-alive every day once a day. I'm using the following code for starting athe AlaramManager Calendar calendar = DateUtils .getNextKeepAliveTime(keepAliveHours, keepAliveMinutes); Intent intent = new Intent(this, AlarmReceiver.class); PendingIntent sender = PendingIntent.getBroadcast(getApplicationContext(), ALARM_REQUEST_CODE, intent, 0); // PendingIntent.FLAG_UPDATE_CURRENT); // Get the AlarmManager service Log.d(TAG, "cal: " + calendar

Dealing with phone's back button: Back button on home activity always to cause app exit

偶尔善良 提交于 2020-01-16 18:25:13
问题 Let's say I have 4 activities in my app: A (main activity) B C D I would like that pressing back in Activity A always produce application exit. In my case if activity flow goes like this A > B > C > A, then if I push back button, I will go to activity C. I want, at that moment, my app to exit. I assume, app should somehow delete activity history when main activity is active. How is this to be done? Thanks 回答1: When you launch your home activity do so with the clear top flag set. This causes

Dealing with phone's back button: Back button on home activity always to cause app exit

守給你的承諾、 提交于 2020-01-16 18:25:13
问题 Let's say I have 4 activities in my app: A (main activity) B C D I would like that pressing back in Activity A always produce application exit. In my case if activity flow goes like this A > B > C > A, then if I push back button, I will go to activity C. I want, at that moment, my app to exit. I assume, app should somehow delete activity history when main activity is active. How is this to be done? Thanks 回答1: When you launch your home activity do so with the clear top flag set. This causes

PROXIMITY_SCREEN_OFF_WAKE_LOCK not working with Samsung

眉间皱痕 提交于 2020-01-16 18:07:51
问题 I am using the Proximity Sensor while webRtc call in android to turn screen on/off using device sensor. It is working perfectly in most of the devices but not in Samsung. When Sensor turns the screen off onStop() of the activity is called. Following is the code I am using : @Override public void onSensorChanged(SensorEvent sensorEvent) { if (sensorEvent.sensor.getType() == Sensor.TYPE_PROXIMITY) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (mWakeLock != null) { mWakeLock