intent

startActivityForResult does not returns anything (Image Picking from a PreferenceActivity)

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a "Select image" in a PreferenceActivity: Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, IMAGE_SELECT); But when I pick an image from Gallery, it does not return anything to my PreferenceActivity's onActivityResult: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Toast.makeText(getApplicationContext(), "THIS TOAST IS NOT SHOWING", Toast.LENGTH_LONG).show(); } What more I need to do? Add something to the

android.content.ActivityNotFoundException “android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS”

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to guide my users to the battery optimizations activity and it seems to be working for most except for some Samsung phones with Android 6 where I get: Fatal Exception: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS } This is what I am using to launch it: Intent intent = new Intent("android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"); startActivity(intent); Any idea what I should be launching on those phones? Thanks. 回答1: Use below code

how to achieve something like “finish” in a non-activity class in android?

匿名 (未验证) 提交于 2019-12-03 00:54:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This dialog asks whether you want to install some other app...so when onclicked no button it must go back to the previous screen downloadDialog . setNegativeButton ( stringButtonNo , new DialogInterface . OnClickListener () { public void onClick ( DialogInterface dialogInterface , int i ) { finish (); } }); this gives the error: The method finish() is undefined for the type new DialogInterface.OnClickListener(){} how can i achieve what i wanted??? package com . Android . barcode ; import android . app . Activity ; import android .

how can I get return value from android services

匿名 (未验证) 提交于 2019-12-03 00:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I got the problem that I don't know how can I fetch return value from services. Why I want return value from services is I want to show this return value in Activity page. Following is my services file and return value is retvalue . public class SyncService extends Service { private String forSync , lastrecordfromlocal , userdefined ; DatabaseUtil dbUtil = new DatabaseUtil ( this ); @Override public IBinder onBind ( Intent arg0 ) { // TODO Auto-generated method stub return null ; } @SuppressWarnings ( "deprecation" ) @Override

widget case that doesn't work with Oreo 8.1 - message received: W/BroadcastQueue: Background execution not allowed: receiving Intent

匿名 (未验证) 提交于 2019-12-03 00:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My widget app is running fine on all android version except 8 Oreo. I get a W/BroadcastQueue: Background execution not allowed: receiving Intent message. There is an interesting blog from CommonsWare but I don't fully understand why it applies to my case. https://commonsware.com/blog/2017/04/11/android-o-implicit-broadcast-ban.html My case looks pretty simple: I have a widget with a button and I want to change the text's button when it is clicked. What is the right way to fix this issue? TestWidget.java public class TestWidget extends

Not allowed to start service Intent X without permission Y

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 04-25 14:16:30.931: E/AndroidRuntime(6638): FATAL EXCEPTION: main 04-25 14:16:30.931: E/AndroidRuntime(6638): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.exclusive26.igale/com.exclusive26.igale.Push_Activity}: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf (has extras) } without permission com.google.android.c2dm.permission.RECEIVE 04-25 14:16:30.931: E

FATAL EXCEPTION: main ; Error receiving broadcast Intent

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My code seems fine but suddenly after cleaning up my code i started reviving a run time error please help : Error Log : 05-04 02:13:13.556: E/MediaPlayer(16609): start called in state 4 05-04 02:13:13.556: E/MediaPlayer(16609): error (-38, 0) 05-04 02:13:13.556: E/MediaPlayer(16609): Error (-38,0) 05-04 02:13:13.558: D/AndroidRuntime(16609): Shutting down VM 05-04 02:13:13.558: W/dalvikvm(16609): threadid=1: thread exiting with uncaught exception (group=0x41c88d40) 05-04 02:13:13.564: E/AndroidRuntime(16609): FATAL EXCEPTION: main 05-04 02

Sinch conference call error

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to start a conference call from my android app but it doesn't work, what I tried is: Intent intent1 = new Intent(CreateGroupCallActivity.this,SinchClientService.class); intent1.setAction(SinchClientService.ACTION_GROUP_CALL); String id = String.valueOf(uid) + "-" + call_id.getText().toString(); intent1.putExtra(SinchClientService.INTENT_EXTRA_ID,id); startService(intent1); and in my SinchClientService : if(intent.getAction().equals(ACTION_GROUP_CALL)) { String id = intent.getStringExtra(INTENT_EXTRA_ID); if(id != null) groupCall

custom Listview Start new activity

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hi i have problem with custom listview with listactivity i want when i click item from listview then new activity will started. Entitiy package com.custom.listview; public class EntitasRestoran { String namaresto = ""; String alamatresto = ""; int pic; public String getNamaResto() { return namaresto; } public void setNamaResto(String n) { this.namaresto = n; } public String getAlamatResto() { return alamatresto; } public void setAlamatResto(String a) { this.alamatresto = a; } public int getPicResto() { return pic; } public void setPicResto

解决华为手机图片选择无效及产生的open failed: EACCES (Permission denied)错误

匿名 (未验证) 提交于 2019-12-03 00:42:01
在华为手机上调起图片选择时原来的效果如下 原来的代码是 Intent intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); intent.setType( " image/* " ); startActivityForResult(intent, CODE_PHOTO_REQUEST); 当使用ACTION_GET_CONTENT时,直接点击“图片”里的照片返回的uri = content://com.android.providers.media.documents/document/image%3A164287,而点击“图库”的照片返回的uri = content://media/external/images/media/164287,选择“图片”中的照片去截取时无效或提示此图片无法加载。 后将action改为ACTION_PICK: Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, " image/* " ); startActivityForResult(intent,