- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是一个食物食谱应用程序,我只是在学习,所以如果你能帮我纠正我的错误并解释,我将非常感激。提前致谢
package rice.recipe;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ListView;
public class RiceActivity extends Activity {
private RiceRecipeDataSource ds;
private ListView recipelistview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rice);
ds=new RiceRecipeDataSource();
recipelistview=(ListView)findViewById(rice.recipe.R.id.listView1);
recipelistview.setAdapter(new RiceRecipeDataSourceAdapter(this,ds ));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.rice, menu);
return true;
}
}
package rice.recipe;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class RiceRecipeDataSourceAdapter extends BaseAdapter {
private Context mycontext;
private LayoutInflater myinflater;
private RiceRecipeDataSource mydatasource;
public RiceRecipeDataSourceAdapter(Context ctx,RiceRecipeDataSource ds)
{
mycontext=ctx;
mydatasource=ds;
myinflater=(LayoutInflater)mycontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mydatasource.getDataSourceLength();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView thumbnail;
TextView name;
if (convertView==null)
convertView=myinflater.inflate(rice.recipe.R.layout.activity_rice, parent,false);
thumbnail=(ImageView)convertView.findViewById(rice.recipe.R.id.imageView1);
thumbnail.setImageResource(mydatasource.getPhotoPool().get(position));
name=(TextView)convertView.findViewById((rice.recipe.R.id.textView1));
name.setText(mydatasource.getDishesPool().get(position));
return convertView;
}
}
package rice.recipe;
import java.util.ArrayList;
public class RiceRecipeDataSource
{
private ArrayList<Integer> photoPool;
private ArrayList<Integer> descriptionPool;
private ArrayList<Integer> dishesPool;
public ArrayList<Integer> getPhotoPool()
{
return photoPool;
}
public ArrayList<Integer> getDescriptionPool()
{
return descriptionPool;
}
public ArrayList<Integer> getDishesPool()
{
return dishesPool;
}
public RiceRecipeDataSource()
{
photoPool=new ArrayList<Integer>();
descriptionPool=new ArrayList<Integer>();
dishesPool=new ArrayList<Integer>();
setupPhotopool();
setupDescriptionpool();
setupDishespool();
}
public void setupPhotopool()
{
photoPool.add(rice.recipe.R.drawable.jollofrice);
photoPool.add(rice.recipe.R.drawable.friedrice);
photoPool.add(rice.recipe.R.drawable.spaghetti);
photoPool.add(rice.recipe.R.drawable.coconutrice);
photoPool.add(rice.recipe.R.drawable.ricenbeans);
photoPool.add(rice.recipe.R.drawable.whiterice);
}
public void setupDishespool()
{
dishesPool.add(rice.recipe.R.string.jellof);
dishesPool.add(rice.recipe.R.string.fried_rice);
dishesPool.add(rice.recipe.R.string.spag);
dishesPool.add(rice.recipe.R.string.coconut);
dishesPool.add(rice.recipe.R.string.rice_beans);
dishesPool.add(rice.recipe.R.string.plain_rice);
}
public void setupDescriptionpool()
{
descriptionPool.add(rice.recipe.R.string.jellof_desc);
descriptionPool.add(rice.recipe.R.string.friedr_desc);
descriptionPool.add(rice.recipe.R.string.spag_desc);
descriptionPool.add(rice.recipe.R.string.coconut_desc);
}
public int getDataSourceLength()
{
return photoPool.size();
}
}
04-03 05:47:34.217: D/dalvikvm(865): GC_FOR_ALLOC freed 39K, 6% free 2657K/2816K, paused 78ms, total 83ms
04-03 05:47:34.237: I/dalvikvm-heap(865): Grow heap (frag case) to 3.783MB for 1127536-byte allocation
04-03 05:47:34.317: D/dalvikvm(865): GC_FOR_ALLOC freed 2K, 5% free 3756K/3920K, paused 80ms, total 80ms
04-03 05:47:34.421: D/dalvikvm(865): GC_CONCURRENT freed <1K, 5% free 3760K/3920K, paused 13ms+20ms, total 108ms
04-03 05:47:34.697: D/AndroidRuntime(865): Shutting down VM
04-03 05:47:34.697: W/dalvikvm(865): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
04-03 05:47:34.778: E/AndroidRuntime(865): FATAL EXCEPTION: main
04-03 05:47:34.778: E/AndroidRuntime(865): java.lang.NullPointerException
04-03 05:47:34.778: E/AndroidRuntime(865): at rice.recipe.RiceRecipeDataSourceAdapter.getView(RiceRecipeDataSourceAdapter.java:52)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.AbsListView.obtainView(AbsListView.java:2159)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.ListView.measureHeightOfChildren(ListView.java:1246)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.ListView.onMeasure(ListView.java:1158)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.View.measure(View.java:15518)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:666)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:477)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.View.measure(View.java:15518)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.View.measure(View.java:15518)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.View.measure(View.java:15518)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-03 05:47:34.778: E/AndroidRuntime(865): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.View.measure(View.java:15518)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.Choreographer.doFrame(Choreographer.java:532)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.os.Handler.handleCallback(Handler.java:725)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.os.Handler.dispatchMessage(Handler.java:92)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.os.Looper.loop(Looper.java:137)
04-03 05:47:34.778: E/AndroidRuntime(865): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-03 05:47:34.778: E/AndroidRuntime(865): at java.lang.reflect.Method.invokeNative(Native Method)
04-03 05:47:34.778: E/AndroidRuntime(865): at java.lang.reflect.Method.invoke(Method.java:511)
04-03 05:47:34.778: E/AndroidRuntime(865): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-03 05:47:34.778: E/AndroidRuntime(865): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-03 05:47:34.778: E/AndroidRuntime(865): at dalvik.system.NativeStart.main(Native Method)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="rice.recipe"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="rice.recipe.RiceActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.main" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
04-03 07:23:36.608: D/dalvikvm(933): GC_FOR_ALLOC freed 46K, 6% free 2657K/2824K, paused 175ms, total 179ms
04-03 07:23:36.631: I/dalvikvm-heap(933): Grow heap (frag case) to 3.783MB for 1127536-byte allocation
04-03 07:23:36.709: D/dalvikvm(933): GC_FOR_ALLOC freed 2K, 5% free 3756K/3928K, paused 75ms, total 75ms
04-03 07:23:36.858: D/dalvikvm(933): GC_CONCURRENT freed <1K, 4% free 3771K/3928K, paused 13ms+19ms, total 153ms
04-03 07:23:37.161: D/AndroidRuntime(933): Shutting down VM
04-03 07:23:37.161: W/dalvikvm(933): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
04-03 07:23:37.248: E/AndroidRuntime(933): FATAL EXCEPTION: main
04-03 07:23:37.248: E/AndroidRuntime(933): java.lang.NullPointerException
04-03 07:23:37.248: E/AndroidRuntime(933): at rice.recipe.RiceRecipeDataSourceAdapter.getView(RiceRecipeDataSourceAdapter.java:52)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.AbsListView.obtainView(AbsListView.java:2159)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.ListView.measureHeightOfChildren(ListView.java:1246)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.ListView.onMeasure(ListView.java:1158)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.View.measure(View.java:15518)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:666)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:477)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.View.measure(View.java:15518)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.View.measure(View.java:15518)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.View.measure(View.java:15518)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-03 07:23:37.248: E/AndroidRuntime(933): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.View.measure(View.java:15518)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.Choreographer.doFrame(Choreographer.java:532)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.os.Handler.handleCallback(Handler.java:725)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.os.Handler.dispatchMessage(Handler.java:92)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.os.Looper.loop(Looper.java:137)
04-03 07:23:37.248: E/AndroidRuntime(933): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-03 07:23:37.248: E/AndroidRuntime(933): at java.lang.reflect.Method.invokeNative(Native Method)
04-03 07:23:37.248: E/AndroidRuntime(933): at java.lang.reflect.Method.invoke(Method.java:511)
04-03 07:23:37.248: E/AndroidRuntime(933): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-03 07:23:37.248: E/AndroidRuntime(933): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-03 07:23:37.248: E/AndroidRuntime(933): at dalvik.system.NativeStart.main(Native Method)
最佳答案
关于java - 出现错误 "Unfortunately you ### application has stopped",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15780437/
我将从 ColdFusion 8 迁移到 ColdFusion 10。 目前,在我的Unix根目录下,我只有1个Application.cfm,在这个根目录下我有大约10个子目录(以前的程序员就是这样
这个问题在这里已经有了答案: Is it possible to write a program in Java without main() using JDK 1.7 or higher? [d
我是编写 Windows 服务应用程序的新手,并且遇到了问题。 我用 Delphi 编写了一个普通的 Windows 应用程序来检查和调试代码的主要部分,现在必须将其转换为 NT 服务。 我的代码必须
我在 Visual Studio 2013 中运行它。 对于 Application.Current.Shutdown 我得到: “Application”是“System.Windows.Appli
给定以下 C++ 代码“mini.cpp”: #include "iostream" using namespace std; int main() { cout << "Hello Worl
什么是“服务器应用程序”?我被要求写一篇关于“服务器应用程序”中的错误的文章,但我不熟悉确切的术语。它们只是网络应用程序,还是其他东西? 最佳答案 “服务器应用程序”是一种应用程序,它等待来自其他应用
JavaFX 应用程序类必须扩展 javafx.application.Application package automationFramework import java.util.concurr
I have implemented deeplinking in my application that open my app (if available) but my app opens
我被困在一个非常基本的问题上。我使用 JavaFX 创建了一个简单的 hello world 程序,它在 JDK 1.8 上运行良好。但是当我切换到 JDK-11 时,它会抛出以下异常: Error:
我可以让Application Insights显示正在运行的每小时使用情况日志,但是有没有一种方法可以每小时显示一次平均使用情况,以查看必须在一天中的哪个时段使用网站? 最佳答案 在您的资源的概览
有谁知道为什么在.NET应用程序中实现Application Insights时不会收集用户代理信息,却能够在浏览器中收集统计信息? 我很希望能够针对特定的用户代理字符串过滤出请求,但是看起来我无法看
我有多个应用程序使用 Application Insights for Production Data。我正在尝试使用 City 遥测字段来映射我们当前的用户。这些数据的跟踪似乎非常不一致,并且在大多
有没有办法在 ASP.NET Web 应用程序中禁用 Application Insights?假设我想关闭生产中运行的应用程序中的所有数据收集。 最佳答案 如果 ikey 在 Application
如何在 Azure Application Insights 中将时差转换为毫秒 let startTime = todatetime('2017-05-15T17:02:23.7148691Z');
我正在修改一个用 Coldfusion 编码的现有 Web 应用程序。在现有代码中,大部分文件夹包含一个 Application.cfm 文件,该文件设置应用程序变量 但是,我对这些应用程序的部分修改
我在 Application Insights Analytics 中有一些数据,它有一个动态对象作为自定义维度的属性。例如: | timestamp | name
首先,我需要的是-n WebBrowser-s,每个都在自己的窗口中执行自己的工作。用户应该能够看到所有这些内容,或者仅看到其中一个(或不显示任何内容),并且能够对每一个执行命令。有一个主要形式,没有
我已收到以下代码以添加到封闭代码(受密码保护)中,以便可以发现错误。 On Error Resume Next: Err.Clear Application.SetOption "Error Trap
我正在使用 Delphi 7。我试图在非 VCL 单元中添加一个调用“application.processmessages”的过程。我收到错误“未声明的标识符:应用程序”。 如何从非 vcl 单元引
考虑一个非外汇现有应用程序,我们将其称为Business。 Business 公开一个 Model 对象,该对象又公开一些属性。 Model 还接受这些属性的监听器。 我的问题是关于向此类应用程序添加
我是一名优秀的程序员,十分优秀!