我不明白为什么我会收到此错误:
Error:(12, 2) error: [dagger.android.AndroidInjector.inject(T)] java.util.Map<java.lang.Class<? extends android.arch.lifecycle.ViewModel>,? extends javax.inject.Provider<android.arch.lifecycle.ViewModel>> cannot be provided without an @Provides-annotated method.
public abstract interface ApplicationComponent {
^
java.util.Map<java.lang.Class<? extends android.arch.lifecycle.ViewModel>,? extends javax.inject.Provider<android.arch.lifecycle.ViewModel>> is injected at
com.chintansoni.android.architecturecomponentsblueprint.viewmodel.KotlinViewModelFactory.<init>(creators)
com.chintansoni.android.architecturecomponentsblueprint.viewmodel.KotlinViewModelFactory is injected at
com.chintansoni.android.architecturecomponentsblueprint.view.activity.SplashActivity.viewModelFactory
com.chintansoni.android.architecturecomponentsblueprint.view.activity.SplashActivity is injected at
dagger.android.AndroidInjector.inject(arg0)
Run Code Online (Sandbox Code Playgroud)
KotlinApplication.kt
class KotlinApplication : Application(), HasActivityInjector {
@Inject
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Activity>
override fun onCreate() {
super.onCreate()
initializeLogger()
initializeAppInjector()
}
private fun initializeAppInjector() {
AppInjector.init(this)
}
private fun initializeLogger() {
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}
override fun …Run Code Online (Sandbox Code Playgroud) 目前,我正在开发类似"待办事项列表"的应用程序.我已在我的应用程序中成功实现了NotificationService和SchedularService.此外,我在为任务设置的时间收到警报(通知).以下是我的疑问:
Notification notification = new Notification(icon, text, time);和notification.setLatestEventInfo(this, title, text, contentIntent);.在developer.android.com上,他们建议使用Notification.Builder.那么如何使我的应用程序与所有API级别兼容.这是用于安排警报的代码段:
...
scheduleClient.setAlarmForNotification(c, tmp_task_id);
...
Run Code Online (Sandbox Code Playgroud)
这是ScheduleClient.java类:
public class ScheduleClient {
private ScheduleService mBoundService;
private Context mContext;
private boolean mIsBound;
public ScheduleClient(Context context)
{
mContext = context;
}
public void doBindService()
{
mContext.bindService(new Intent(mContext, ScheduleService.class), mConnection, Context.BIND_AUTO_CREATE);
mIsBound = true;
}
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
mBoundService = ((ScheduleService.ServiceBinder) service).getService();
}
public …Run Code Online (Sandbox Code Playgroud) 我已经开始创建一个类似于"To do task manager"概念的应用程序,其中我需要使textview可取消,例如,当用户点击完成图像时,视图中的整个文本将被取消.
任何人都可以指导我,如何实现这一机制?
在参加Google IO 2016扩展后,我从https://dl.google.com/dl/android/studio/ide-zips/2.2.0.0/android-studio-ide-145.2878421-linux.zip下载了工作室
我提取了它.但在那之后,我无法执行studio.sh ..
它显示以下错误:
To-be-filled-by-O-E-M:~/Applications/android-studio/bin$ ./studio.sh
./studio.sh: 137: ./studio.sh: declare: not found
./studio.sh: 141: ./studio.sh: Syntax error: "(" unexpected (expecting "fi")
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
注意:我已在Google Plus社区Android Studio上发布此问题.她是我帖子的链接
所以,我陷入了一种奇怪的行为,也就是说,我能够使用Postman (plugin of chrome)或使用发送(或POST)数据RESTClient(extension of Firefox),

但是无法从我位于项目之外的html文件中发送它.当我在chrome中打开html时显示以下错误:
OPTIONS http://localhost:1176/api/user/ 405 (Method Not Allowed)
XMLHttpRequest cannot load http://localhost:1176/api/user/. Invalid HTTP status code 405
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么会这样.以下是详细信息,您可能需要帮我解决我的错误:
UserController.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPIv2.Models;
namespace WebAPIv2.Controllers
{
public class UserController : ApiController
{
static IUserRepository userRepository = new UserRepository();
[HttpGet]
public List<TableUser> GetAllUsers()
{
return userRepository.GetAll();
}
[HttpGet]
public HttpResponseMessage GetUser(int id)
{
TableUser user = userRepository.Get(id);
if (user == null)
{ …Run Code Online (Sandbox Code Playgroud) 所以我明白我可以做一个这样的按钮组,这很棒。
然而,我怎样才能做到这一点,当按下所说的按钮之一时,它看起来像是被选中了呢?因为这一切都是点击效果?
基本上我想做的是,当单击按钮时,它将输入值更改为按钮的值。但我希望该按钮看起来像是已被选中。
<ButtonGroup disableElevation variant="contained" color="primary">
<Button>One</Button>
<Button>Two</Button>
</ButtonGroup>
Run Code Online (Sandbox Code Playgroud) 我有一个问题.在我的XML文件中进行修改之前,我的listview能够完美地工作.但现在,经过xml的一些修改后,它无法正常工作.我的listview是自定义的.所以,我创建了单独的xml来渲染listview中的每一行.
我的单row.xml代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="@+id/relativeLayoutSingleRowManageAddictions"
android:layout_height="40dp"
android:background="@drawable/box_midbg" >
<TextView
android:id="@+id/textViewSingleRowManageAddictions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="17dp"
android:text="TextView"
android:textSize="20dp"
android:textColor="#ffffff" />
<ImageView
android:id="@+id/imageViewSingleRowManageAddictions"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/listing_arrow" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我的main.xml代码中的ListView所在:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_bg_edited" >
<RelativeLayout
android:id="@+id/relativeLayout1"
style="@style/top_bar_style" >
<ImageView
android:id="@+id/imageViewMAnageAddictionsBack"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/back_arrow"
android:clickable="true" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/header_style"
android:text="Manage Addictions" />
<ImageView
android:id="@+id/imageViewManageAddictionsAdd"
android:layout_width="25dp"
android:layout_height="20dp"
android:layout_marginRight="3dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/plus_nav"
android:clickable="true" />
</RelativeLayout>
<ListView
android:id="@+id/listViewManageAddictions"
android:layout_width="290dp"
android:layout_height="fill_parent"
android:layout_below="@+id/relativeLayout1"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true" …Run Code Online (Sandbox Code Playgroud) 在我的申请中.我有一个login屏幕.如果登录成功,tab activity将启动a,因为有4个选项卡.当我按下选项卡中的一个按钮时,将启动一个新活动.在我的login班级中有一个事件会在某些情况下被解雇.我想在事件被触发时返回标签活动.我用Intent编写了一个代码.该代码工作正常.但是在达到标签活动后,我不想在按下后退按钮时返回活动状态.我想删除它.我想在按下Back时显示登录信息.有没有办法做到这一点?这是我用过的代码:
Intent tabi=new Intent(getApplicationContext(),Tab.class);
startActivity(tabi);
Run Code Online (Sandbox Code Playgroud)
onkeydown标签活动中的代码是:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
super.onKeyDown(keyCode, event);
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用intel XDK一周.它很好用intel xdk.它的构建版本是构建0277.我在学习时创建了几个测试项目,在云上创建了几个构建.但我没有找到任何从云中删除这些构建的选项.是的,当然,可以删除项目,但不能删除它们在云上的构建.
如果有人知道,怎么做,请帮帮我..
我总是更新库更新,这就是它的结果.
在build.gradle(Project:xxx)中:
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
Run Code Online (Sandbox Code Playgroud)
在build.gradle中(模块:app)
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
Run Code Online (Sandbox Code Playgroud)
并输入密码字段如下:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
Taadaa ...我的密码字段现在如下所示:
你也可以随便去EditText.
但是,此更新中存在一些问题.
问题: 如果我在EditText中放置任何drawableRight,它什么都不显示.TextInputLayout还具有禁用切换功能的属性.我也是这样做的,但没有成功:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="false">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_alarm_on_black_24dp"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我.
android android-edittext android-design-library android-textinputlayout