start-activity

onSaveInstanceState is not getting called

社会主义新天地 提交于 2019-12-30 11:04:27
问题 I have an activity which starts various activities for result codes and on getting results in onActivityResult method it starts appropriate activity based on result code. onSaveInstanceState is not getting called in Activity which started for result. For example Navigation Activity starts Activity A as : Intent intent = new Intent(this, A.class); startActivityForResult(intent, Constants.REQUEST_CODE); Then A finishes by setting result code so App will redirect to Navigation activity again and

Can't start activity from BroadcastReceiver on android 10

穿精又带淫゛_ 提交于 2019-12-28 06:39:30
问题 I updated my OS version to android 10 last night, and since then the startActivity function inside the broadcast receiver is doing nothing. This is how I try to start the activity based on the answer of CommonsWare: Intent i = new Intent(context, AlarmNotificationActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { // This is at least android 10... Log.d("Debug", "This is android 10"); // Start the

how to start new activity via gridview onitemclick?

删除回忆录丶 提交于 2019-12-25 19:29:24
问题 i want to open new activity on itemclick listner in gridview.like this. Click position 1(india) ->open activity 1.Click position 2(brazil)->open activity 2.Click position 3(canada)->open activity 3. how to possible it? This is my code. android.widget.AdapterView.OnItemClickListener; public class GridViewExampleActivity extends Activity { /** Called when the activity is first created. */ private GridviewAdapter mAdapter; private ArrayList<String> listCountry; private ArrayList<Integer>

startActivity not working

纵然是瞬间 提交于 2019-12-24 12:33:40
问题 public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //Toast.makeText(getApplicationContext(), "Position of selected item is: "+ position, Toast.LENGTH_LONG).show(); if ("Abiding in Christ".equals(categories[position])) {startActivity(AbidingInChrist.class);} else if ("Abundant Living".equals(categories[position])) {startActivity(AbundantLiving.class);} else if ("Access to God".equals(categories[position])) {startActivity(AccessToGod.class);} else if ("Adoration

Why is onActivityResult is called before a contact is chosen?

瘦欲@ 提交于 2019-12-24 11:28:31
问题 I'm following the answer https://stackoverflow.com/a/867828/129805 to add a contact picker to my app. The problem is that onActivityResult is immediately invoked with the correct reqCode ( PICK_CONTACT ), but with a resultCode of 0 and a null for data. It is not invoked again, when the user actually picks a contact. The AndroidManifest gives this activity android:launchMode="singleInstance"> as I only ever want there to be one instance. What have I done wrong? MainActivity.java: @Override

Video free multi window size is not changed in android 7.1

让人想犯罪 __ 提交于 2019-12-23 03:38:15
问题 I'm working on free multi window in android 7.1 . With test application free multi window is working perfect.(please fine screenshot 1) Now Im playing video using MX player app, at that time free multi window size is not effecting.(please fine screenshot 2) String mxPlayer = "com.xx.xx.ad"; intent1 = new Intent(Intent.ACTION_VIEW); intent1.setPackage(mxPlayer); Uri videoUri = Uri.parse("http://xxx.75.135/Files/xxx/1_video/ideo.m3u"); intent1.setDataAndType(videoUri, "application/mp4");

Android Can you get an activity result from a chained startActivityForResult

孤街醉人 提交于 2019-12-20 15:12:07
问题 I have the following activity screens Activity A - contains a button that links to Activity B Activity B - contains a confirmation of order and then a Next button that opens up a Activity C (to capture signature) Activity C - a dialog box that pops up for the user to enter their signature and a complete button. Activity A - contains intent start to start Activity B and implements onActivityForResult Intent intent = new Intent( this, ConfirmLines.class ); startActivityForResult( intent, GET

ACTION_INSTALL_PACKAGE

我怕爱的太早我们不能终老 提交于 2019-12-18 12:30:10
问题 My app is trying to install an APK. Intent installIntent = new Intent(Intent.ACTION_INSTALL_PACKAGE); installIntent.setData(Uri.fromFile(new File(pathToApk))); installIntent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true); installIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true); installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ((Activity)context).startActivityForResult(installIntent, Constants.APP_INSTALL_REQUEST); In my Activity protected void onActivityResult(int requestCode, int

StartActivityForResults always returns RESULT_CANCELLED for Intent.ACTION_SEND

安稳与你 提交于 2019-12-17 15:58:13
问题 As the share pop up appears, I shared the content on WhatsApp successfully, but still returns RESULT_CANCELLED. Same result when I send a email using Gmail. Calling Sharing intent, ACTION_SEND with startActivityForResult always returns CANCELLED Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_TITLE, "Taxeeta, Cab Around The Curb"); sharingIntent .putExtra( android.content.Intent.EXTRA_TEXT, "Hiring

Starting a 3rd Activity setting up interfaces and listeners [duplicate]

一笑奈何 提交于 2019-12-14 03:28:36
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Closed 2 years ago . So my MainActivity was able to start my second activity from a btn click fine. Now on my second activity, I have a drag and drop type game where what I want is one the correct image was dropped, I want it to start a 3rd Activity but I am getting a java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName