xamarin.android

Android gradle multiproject dependency resolution

*爱你&永不变心* 提交于 2020-03-12 06:03:56
问题 In my Android project I have a task for copying the build dependencies to an external directory as below: task copyBuildDependencies(type: Copy) { delete "$buildDir/dependencies" afterEvaluate { from configurations.releaseCompileClasspath into "$buildDir/dependencies" doLast { FileTree files = fileTree("$buildDir/dependencies") files.forEach { file -> if (file.isFile() && file.name.endsWith(".aar")) { copy { from zipTree(file).matching { include "*.jar" } into "$buildDir/dependencies"

从Activity上下文外部调用startActivity()

半世苍凉 提交于 2020-03-06 21:53:27
我已经在我的Android应用程序中实现了 ListView 。 我使用 ArrayAdapter 类的自定义子类绑定到此 ListView 。 在重写的 ArrayAdapter.getView(...) 方法内部,我分配了一个 OnClickListener 。 我想在 OnClickListener 的 onClick 方法中启动一个新活动。 我得到例外: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? 如何获取 ListView (当前 Activity )在其下工作的 Context ? #1楼 您可以使用 addFlags 代替 setFlags 来实现 myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 根据 文档, 它可以: 向意图添加其他标志(或使用现有标志值)。 编辑 请注意,如果您使用的标志会更改历史记录堆栈,如 Alex Volovoy的回答所述 : ...避免设置标志,因为它会干扰事件和历史记录堆栈的正常流程。 #2楼 对于即使在活动中调用StartActivity的情况下,也可以在

I am trying to list and open folders in visual studio xamarin.android

自古美人都是妖i 提交于 2020-03-06 09:20:05
问题 I am trying to learn the cross platform development, I want to make a simple test app that will list folders in a list, a button that will open a selected folder, and a button to create a folder within the app. I did find one project to look at ...directoryselection But apparently it has been depreciated, and when I import it there are a lot of errors. Any help would be greatly appreciated. Mark 来源: https://stackoverflow.com/questions/60351971/i-am-trying-to-list-and-open-folders-in-visual

Build Xamarin.Android doesn't work with AOT

二次信任 提交于 2020-03-05 12:47:15
问题 I created new project xamarin forms protable. I didn't add other code in projects. When I build Android project with AOT options I get error: [AOT] E:\works\xamarin\projects\TestAot\TestAot\TestAot.Droid\obj\Release\android\assets\TestAot.Droid.dll Could not AOT the assembly: obj\Release\android\assets\TestAot.Droid.dll Xamarin.VS and Android SDK updated to last versions. How fix it? Thank you. 回答1: Faced that if you enable llvm along with aot, it just gives you the above error. Some say it

Detection of swiping on a normal Android Activity

二次信任 提交于 2020-03-01 21:57:40
问题 Is it possible, to detect a swiping to the left/right of the user in a normal Android activity? Or do I have to use a SwipeView? 回答1: If you are looking for a Xamarin/C# example Implement GestureDetector.IOnGestureListener on your Activity (or view) and calculate the direction of the touch in the OnFling method: [Activity(Label = "Swiper", MainLauncher = true, Icon = "@mipmap/icon")] public class MainActivity : Activity, GestureDetector.IOnGestureListener { GestureDetector gestureDetector;

Detection of swiping on a normal Android Activity

余生颓废 提交于 2020-03-01 21:56:16
问题 Is it possible, to detect a swiping to the left/right of the user in a normal Android activity? Or do I have to use a SwipeView? 回答1: If you are looking for a Xamarin/C# example Implement GestureDetector.IOnGestureListener on your Activity (or view) and calculate the direction of the touch in the OnFling method: [Activity(Label = "Swiper", MainLauncher = true, Icon = "@mipmap/icon")] public class MainActivity : Activity, GestureDetector.IOnGestureListener { GestureDetector gestureDetector;

Android Data Binding Library in Xamarin.Android

*爱你&永不变心* 提交于 2020-02-29 19:11:33
问题 I am using Xamarin.Android (IDE: Visual Studio 2015) and would like to work with the new Data Binding Library from Google. Is it possible (and how)? Or is the Data Binding Library only available in Android Studio?? https://developer.android.com/tools/data-binding/guide.html Felix 回答1: The data-binding library is actually part of the gradle build toolkit so isn't available in Xamarin.Android applications. However there are plenty of data binding frameworks out there. MVVMLight, MVVMCross, Bind

Android Data Binding Library in Xamarin.Android

前提是你 提交于 2020-02-29 19:10:45
问题 I am using Xamarin.Android (IDE: Visual Studio 2015) and would like to work with the new Data Binding Library from Google. Is it possible (and how)? Or is the Data Binding Library only available in Android Studio?? https://developer.android.com/tools/data-binding/guide.html Felix 回答1: The data-binding library is actually part of the gradle build toolkit so isn't available in Xamarin.Android applications. However there are plenty of data binding frameworks out there. MVVMLight, MVVMCross, Bind

How can I make my app send out notifications when it's loaded but not running in the foreground?

不羁岁月 提交于 2020-02-27 06:28:49
问题 I have an app that I use sometimes. I must have left it there in the background before I slept. When I woke up I saw this notification on my screen. Does anyone have any suggestions on how I can make a notification like this appear with my XF application? Also, do these notifications appear on Android also? I've never seen them on my Android phone but that could be because I use it much less. 回答1: We can use Shiny.Notifications NuGet Package to create cross-platform Local Notifications in

尝试运行.jar时出现“无效签名文件”

こ雲淡風輕ζ 提交于 2020-02-27 03:29:58
我的Java程序打包在jar文件中,并使用外部jar库 bouncy castle 。 我的代码可以正常编译,但是运行jar会导致以下错误: 线程“主”中的异常java.lang.SecurityException:清单主要属性的无效签名文件摘要 我在Google上搜索了一个多小时,一直在寻找解释,却发现价值不大。 如果有人以前曾见过此错误并可以提供帮助,我将有义务。 #1楼 对于使用gradle并尝试创建和使用胖子的人,以下语法可能会有所帮助。 jar { doFirst { from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } } exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' } #2楼 两种不同的签名者可能会使Java思维混乱。 尝试从jar中删除META-INF文件夹,添加清单并再次签名JAR,它对我有帮助: http : //jehy.ru/articles/2013/12/13/invalid-signature-file-digest-for-manifest-main-属性/ #3楼 如果在尝试为Xamarin.Android绑定项目绑定JAR文件时遇到这种情况,请执行以下操作: