我在过去几天看过几篇帖子,我似乎无法弄清楚我的问题是什么.我检查了活动名称,它们是相同的.我也检查了我的清单,我也在.活动前面.
这是我的logcat文件:
02-23 16:48:22.438 1508-1508/com.pctoolman.planme.app E/AndroidRuntime? FATAL
EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.pctoolman.planme.app/com.pctoolman.planme.app.PlanMeMainActivity}:
java.lang.ClassCastException: com.pctoolman.planme.app.PlanMeMainActivity cannot be
cast
to android.app.Activity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: com.pctoolman.planme.app.PlanMeMainActivity
cannot
be cast to android.app.Activity
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525) …Run Code Online (Sandbox Code Playgroud) 您好我之前询问过有关使用Firebase数据库中的Base64显示图像的问题.建议使用firebase存储.我重新编写了代码,所有内容都加载到firebase存储和数据库中.我遇到的问题是当我保存数据时,没有任何内容填充到我的recyclerview中.一切都是空白的.
你可以提供给我这个工作的任何帮助都会很棒.谢谢.
编辑:在我的活动类中,我调用一个按钮clicklistener来激活相机.拍摄照片后,它将保存到Firebase存储.然后我从存储中下载图像并将其显示在recyclerview中.我理解上传部分,但我很难理解下载和显示部分.谢谢.
viewholder:绑定方法
public void bind (ImageProgress progress){
Glide.with(activity).load("").into(image);
}
}
Run Code Online (Sandbox Code Playgroud)
适配器
@Override
public ProgressViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
return new ProgressViewHolder(activity, activity.getLayoutInflater().inflate(R.layout.weight_progress_list, parent, false));
Run Code Online (Sandbox Code Playgroud)
主要活动课
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.weight_progress);
saveButton = (Button) findViewById(R.id.saveButton);
progressStatusEditText = (EditText) findViewById(R.id.progressStatusEditText);
progressList = (RecyclerView) findViewById(R.id.progressList);
mImageButton = (ImageButton) findViewById(R.id.takePictureButton);
capturedImage=(ImageView)findViewById(R.id.capturedImageView);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
progressList.setHasFixedSize(false);
progressList.setLayoutManager(layoutManager);
//take picture button
mImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openCamera();
}
});
mDatabaseReference = database.getReference("Progress");
saveButton.setOnClickListener(new View.OnClickListener() { …Run Code Online (Sandbox Code Playgroud)