小编Ast*_*hme的帖子

如何在android studio上找到日志?

我试图将我的项目导入到android studio中.将显示错误.我需要知道我在哪里获取日志?

Consult IDE log for more details (Help | Show Log)
Run Code Online (Sandbox Code Playgroud)

android android-studio

86
推荐指数
6
解决办法
10万
查看次数

java.lang.IllegalMonitorStateException:对象在wait()之前没有被线程锁定?

我正在使用进度dialog.i需要在用户关闭progressdialog时停止该线程.不幸的是它给出了异常请帮助我..

在内心阶级

class UpdateThread extends Thread{

    public  void run() {
        while (true){
            count=adapter.getCount();

            try {
               mHandler.post(  new Runnable() {
                    public  void run() {
                        Log.i(TAG,count+"count");
                        progressDialog.setMessage(count + "Device  found");
                    }
                });
                Thread.sleep(300);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在OnCreate

 updateThread=new UpdateThread();

 progressDialog= new ProgressDialog(GroupListActivity.this);
 synchronized (this) {
     updateThread.start();
 }
Run Code Online (Sandbox Code Playgroud)

ondismissal

   progressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public  void onDismiss(DialogInterface dialog) {
            try {
                synchronized (this) {
                    updateThread.wait(300);
                }

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            Log.i(TAG,"Thread is stopped");
        } …
Run Code Online (Sandbox Code Playgroud)

java multithreading android

41
推荐指数
2
解决办法
8万
查看次数

我在android studio上遇到了奇怪的错误

请任何人帮助我.这是错误:错误:没有这样的属性:类的nexusUsername:org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer

堆栈跟踪

Information:Gradle tasks [:app:compileDebugJava]
Information:FAILURE: Build failed with an exception.
Information:* What went wrong:
Information:A problem occurred configuring project ':app'.
Information:> A problem occurred configuring project':libraries:HoloColorPicker-    master'.
Information:   > No such property: nexusUsername for class:        org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
       Information:* Try:
          Information:Run with --stacktrace option to get the stack trace. Run with --info                       or --debug option to get more log output.
Information:0 errors
Run Code Online (Sandbox Code Playgroud)

settings.gradle

include ':app'
include ':libraries:HoloColorPicker-master'
Run Code Online (Sandbox Code Playgroud)

的build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.3'

    defaultConfig {
        minSdkVersion 8 …
Run Code Online (Sandbox Code Playgroud)

android android-studio

17
推荐指数
2
解决办法
2万
查看次数

使用customview获取输入文本而不使用edittext android

我创建了customview.每当用户双击视图时,它应显示键盘,用户可以绘制新文本.

Holder是一个扩展视图的自定义视图.但它正在显示键盘.如何获取文字?

 public Holder(Context context, AttributeSet attrs) {
    super(context, attrs);
    Log.e(TAG,"EXE");
    imm = (InputMethodManager)
           context. getSystemService(Context.INPUT_METHOD_SERVICE);



 public boolean onDoubleTap(MotionEvent e) {        

        View view = Holder.this.getRootView();
        imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
     // imm.showSoftInput(Holder.this, InputMethodManager.SHOW_FORCED);  not working
Run Code Online (Sandbox Code Playgroud)

android canvas android-input-method

15
推荐指数
2
解决办法
3998
查看次数

如何在使用gson转换器时将改装用作单件?

从@jake Wharton的回答中,您应该只调用一次restAdapter.create,并在每次需要进行交互时重复使用相同的MyTaskService实例.我不能强调这一点.您可以使用常规单例模式,以确保在任何地方只使用这些对象的单个实例.依赖注入框架也可用于管理这些实例,但如果您尚未使用它,则会有点矫枉过正.

这是我的代码

public class MusicApi {
private static final String API_URL = "https://itunes.apple.com";
private static MusicApiInterface sMusicApiInterface;

public static MusicApiInterface getApi() {
    if (sMusicApiInterface == null) {
        sMusicApiInterface = null;
        RestAdapter restAdapter = new RestAdapter.Builder()
                .setEndpoint(API_URL)
                .build();

        sMusicApiInterface = restAdapter.create(MusicApiInterface.class);
    }
    return sMusicApiInterface;
}

public interface MusicApiInterface {
    @GET("/search?entity=musicVideo")
    NetworkResponse getMusic(@Query("term") String term);

    @GET("/search?entity=musicVideo")
    void getMusic(@Query("term") String term, Callback<NetworkResponse> networkResponseCallback);

    @GET("/search?entity=musicVideo")
    Observable<NetworkResponse> getMusicObservable(@Query("term") String term);
}
Run Code Online (Sandbox Code Playgroud)

}

一切正常.我正在使用类型适配器,对于每个请求,我需要创建不同类型的gson解析并设置为适配器.

Gson gson = new GsonBuilder().registerTypeAdapter(DiscussionViewMoreContainer.class, new ExplorerDeserializerJson())
            .create();
Run Code Online (Sandbox Code Playgroud)

它让我每次都要创造一个新的restadapter.在我的应用程序中,一些请求并行运行.这是正确的方法吗?

java rest android gson retrofit

15
推荐指数
1
解决办法
3780
查看次数

Recyclerview视图不能与setNestedScrollingEnabled一起使用,它也永远不会回收任何视图

我面临两个问题:

  1. 滚动侦听器将无法工作
  2. RecyclerView当它连接到一个从来不回收任何意见NestedScrollView.它就像ScrollView中的线性布局.它使用大量内存并造成滞后.

我在回收器视图的顶部附加了一个youtube播放器片段,因为我无法在回收器视图中放置片段.在我的代码中,您可以看到有一个框架布局.

我的布局看起来像这样:

    <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/nestedScroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:orientation="vertical">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <FrameLayout               
                android:layout_width="match_parent"
                android:layout_height="240dp"
                android:layout_alignParentTop="true"/>





        </LinearLayout>


        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/youtube_layout"
            android:visibility="visible"/>




    </LinearLayout>
</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)

我想使用滚动侦听器来加载更多项目,所以我尝试了以下内容:

@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    Log.i(TAG, "onScrolled: ");
    // bail out if scrolling upward or already loading data
    if (dy < 0 || dataLoading.isDataLoading()) return;

    final int visibleItemCount = recyclerView.getChildCount();
    final int totalItemCount = layoutManager.getItemCount(); …
Run Code Online (Sandbox Code Playgroud)

android onscrolllistener android-recyclerview android-nestedscrollview

14
推荐指数
1
解决办法
3169
查看次数

在毕加索加载图片后无法隐藏进度条?

我试图在ma app中集成进度条.但我无法跟踪回调方法.进度条总是显示如何隐藏图像被锁定时?

holder.imageView = (ImageView) localView.findViewById(R.id.imageView1);
holder.progressBar = (ProgressBar) localView.findViewWithTag(R.id.progressBar1);

localView.setTag(holder);
url = getItem(paramInt);
Picasso.with(getApplicationContext())
.load(url)
.placeholder(R.drawable.ic_launcher)
.error(R.drawable.ic_launcher)
.fit()
.into(holder.imageView, new Callback() {

    @Override
    public void onSuccess() {
        holder.imageView.setVisibility(View.VISIBLE);
        holder.progressBar.setVisibility(View.INVISIBLE);        
    }

    @Override
    public void onError() {
        holder.progressBar.setVisibility(View.VISIBLE);
        holder.imageView.setVisibility(View.INVISIBLE);
    }
});
Run Code Online (Sandbox Code Playgroud)

android view callback progress-bar picasso

11
推荐指数
1
解决办法
6297
查看次数

Spannable Vs Typeface Vs Html

我正在准备包含自定义样式的复选框的应用程序,如粗体,斜体,下划线,color.etc ..我有点困惑哪种方法对性能有好处.我尝试过类型面,但是当用户选择两个复选框时,它只显示最后一个值.它不能正常工作.

android textview

10
推荐指数
1
解决办法
1521
查看次数

可扩展ListView中的hasStableIds()?

我正在创建app使用ExpandableListView,我提到了一些教程.将hasStableIds()设置为false?将hasStableIds()设为false的确切需要是什么?

android expandablelistview

10
推荐指数
1
解决办法
4651
查看次数

在android studio中导入项目时出错?

最近我将我的android工作室更新为0 .30我试图在android studion中导入项目.

Project正在使用旧版本的Android Gradle插件.支持的最低版本为0.6.1.

请在build.gradle文件中更新依赖项"com.android.tools.build:gradle"的版本.

有关更多详细信息,请参阅IDE日志(帮助|显示日志)

第二个错误

您正在使用旧的,不受支持的Gradle版本.请使用1.8或更高版本.请在项目的Gradle设置或
项目的Gradle包装器中指向支持的Gradle版本(如果适用).有关详细信息,请参阅IDE日志(帮助|显示日志)

第三个错误

无法使用Gradle分发' http://services.gradle.org/distributions/gradle-1.6-bin.zip ' 执行构建 .构建文件'C:\ Users\Asthme\crushersblue1\babies\build.gradle'行:8

无法
在项目':crushersblue1:babies'上找到参数[com.android.tools.build:gradle:0.6.+]的方法classpath().

有关更多详细信息,请参阅IDE日志(帮助|显示日志)

android android-studio

9
推荐指数
2
解决办法
1万
查看次数