我正在努力解决这个错误:
08-08 11:42:53.179:E/AndroidRuntime(20288):引起:java.lang.InstantiationException:无法实例化类com.example.localnotificationtest.ReminderService; 没有空的构造函数
我不明白为什么会出现这种错误.
我试图在特定时间出现通知,并在搜索一段时间后,我发现这个旧的stackoverflow问题.我尝试了一切,但我的代码给出了错误.
请帮我解决这个问题.
这是我的MainActivity代码:
public class MainActivity extends Activity {
int mHour, mMinute;
ReminderService reminderService;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
reminderService = new ReminderService("ReminderService");
TimePickerDialog dialog = new TimePickerDialog(this, mTimeSetListener, mHour, mMinute, false);
dialog.show();
}
TimePickerDialog.OnTimeSetListener mTimeSetListener = new OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker v, int hourOfDay, int minute) {
mHour = hourOfDay;
mMinute = minute;
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, Calendar.YEAR);
c.set(Calendar.MONTH, Calendar.MONTH);
c.set(Calendar.DAY_OF_MONTH, Calendar.DAY_OF_MONTH); …Run Code Online (Sandbox Code Playgroud) 我试图实现下图所示的效果:

在此图像中,有一个带有圆角和内部阴影的编辑文本.我尝试了很多,但没有成功在edittext中获取阴影.
我搜索了这个主题但是所有的例子都显示了edittext border之外的阴影.我不知道我怎么能做到这一点.
按钮和背景图像已经完成,唯一剩下的就是edittext阴影.如果有人已经这样做或知道如何做到这一点请与我分享.任何帮助都应该得到赞赏.
我正在尝试使用以下代码滚动我的textview:
TextView text = (TextView) findViewById(R.id.textView12);
text.setMovementMethod(ScrollingMovementMethod.getInstance());
int height = getResources().getDrawable(R.drawable.pic_ground_pranic).getIntrinsicHeight();
text.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, height));
text.setText("As part of an Android App I am building a button set.For performance reasons and to keep the code simpler, the Android system uses pixels as the standard unit for expressing dimension or coordinate values. That means that the dimensions of a view are always expressed in the code using pixels, but always based on the current screen density. For instance, if myView.getWidth() returns 10, the …Run Code Online (Sandbox Code Playgroud) 我试图直接点击按钮打开电子邮件发送邮件形式,但这始终显示发送电子邮件的选项列表.
我这样做是为了打开GMail表单:
Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND);
String[] recipients = new String[]{"" , "" ,};
emailIntent.putExtra( android.content.Intent.EXTRA_EMAIL, recipients);
emailIntent.putExtra( android.content.Intent.EXTRA_SUBJECT, "This is my text" );
emailIntent.putExtra( android.content.Intent.EXTRA_TEXT, "");
emailIntent.setType("message/rfc822");
startActivity( Intent.createChooser(emailIntent, "Send Email" ));
Run Code Online (Sandbox Code Playgroud)
但这不是开放GMail形式.如何打开GMail表格请帮忙.
有没有办法做到这一点?
我试图在我的应用程序中创建一个移动的球动画一切正常,球移动我想要但它不顺利.我尝试了一切使它顺利,但每次失败都没有运气.
这是我的xml代码:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="true" >
<translate
android:duration="3000"
android:fromXDelta="-1%p"
android:fromYDelta="-87%p"
android:toXDelta="1%p"
android:toYDelta="-40%p" />
<translate
android:duration="3000"
android:fromXDelta="2%p"
android:fromYDelta="0%p"
android:startOffset="2200"
android:toXDelta="0%p"
android:toYDelta="42%p" />
<translate
android:duration="4000"
android:fromXDelta="0%p"
android:fromYDelta="42%p"
android:startOffset="4500"
android:toXDelta="-5%p"
android:toYDelta="0%p" />
<translate
android:duration="4000"
android:fromXDelta="0%p"
android:fromYDelta="0%p"
android:startOffset="5500"
android:toXDelta="4%p"
android:toYDelta="-47%p" />
</set>
Run Code Online (Sandbox Code Playgroud)
这是我的java代码:
ImageView image = (ImageView)findViewById(R.id.imageView1);
Animation anim = AnimationUtils.loadAnimation(this, R.drawable.moveing_ball_anim);
image.startAnimation(anim);
Run Code Online (Sandbox Code Playgroud)
我以这种形状移动图像.

我是android的新手,我使用以下方法打印log-cat:
Log.w("Tag", "String text");
Run Code Online (Sandbox Code Playgroud)
和日志文本打印,但搜索一段时间后,我找到一些更多的方式来打印logcat,如:
Log.v()
Log.d()
Run Code Online (Sandbox Code Playgroud)
现在我对这些方法感到困惑.
哪个是打印log-cat的最佳方法,打印lagcat的方法怎么样,它们之间的主要区别是什么?
我正在尝试将字符串转换为Integer/Float/Double但我得到了一个NumberFormatException.
我的字符串是37,78584,现在我将其转换为我得到的任何一个NumberFormatException.
我怎样才能将其转换string为其中任何一个.
请帮我解决这个问题.
我正在使用翻译动画来移动ImageView.我正在使用此代码:
TranslateAnimation set1 = new TranslateAnimation(-4, 10, -110, 0);
set1.setDuration(3000);
TranslateAnimation set2 = new TranslateAnimation(10, -3, 0, 115);
set2.setDuration(3000);
set2.setStartOffset(2200);
TranslateAnimation set3 = new TranslateAnimation(-3, -20, 0, -100);
set3.setDuration(3000);
set3.setStartOffset(4500);
TranslateAnimation set4 = new TranslateAnimation(0, 13, 0, -120);
set4.setDuration(3000);
set4.setStartOffset(6500);
animSet.addAnimation(set1);
animSet.addAnimation(set2);
animSet.addAnimation(set3);
animSet.addAnimation(set4);
animSet.setFillAfter(true);
Run Code Online (Sandbox Code Playgroud)
创建一组动画后,我将它们应用于ImageView以下内容:
image = (ImageView)findViewById(R.id.img);
image.startAnimation(animSet);
Run Code Online (Sandbox Code Playgroud)
一切都运行正常,但我不能暂停动画并继续点击按钮.
我怎样才能做到这一点?
我尝试了一切,但没有成功.知道怎么做吗?
请帮忙!
我正在研究一个Android项目,我遇到了一个问题,问题是:
当我退回时,Arraylist为空.
这是我的java代码:
ArrayList<ArrayList<Object>> container = new ArrayList<ArrayList<Object>>();
ArrayList<Object> itemRow = new ArrayList<Object>();
JSONObject jsonObj = new JSONObject(result);
JSONArray allElements = jsonObj.getJSONArray("Table");
Log.i("allElements", "" + allElements);
for (int i = 0; i < allElements.length(); i++) {
itemRow.add(allElements.getJSONObject(i).getString("ParentName").toString());
itemRow.add(allElements.getJSONObject(i).getString("ParentEmailID").toString());
itemRow.add(allElements.getJSONObject(i).getString("ParentContact").toString());
itemRow.add(allElements.getJSONObject(i).getString("ParentAddress").toString());
itemRow.add(allElements.getJSONObject(i).getString("ParentProfilePictureName").toString());
itemRow.add(allElements.getJSONObject(i).getString("StudentName").toString());
Log.i("itemRow", "itemRow at index: " + i + ", " + itemRow);
container.add(((i*2)/2), itemRow);
itemRow.clear();
}
return container;
Run Code Online (Sandbox Code Playgroud)
在这段代码中,我有两个Arraylist用于包含所有元素,另一个用于存储单行元素.这些Arraylist是从JSONArray加载的,一切正常,我可以从项目行(Arraylist,单行)打印数据并存储到主Arraylist(容器).
但是当我返回这个Arraylist(容器)并在logcat中打印时,它会显示空的Arraylist
[[], [], [], [], []].
Run Code Online (Sandbox Code Playgroud)
我不明白为什么会发生这种情况请帮我解决这个问题.
谢谢.
我试图在我的推特墙上发布链接,就像更新状态或在墙上发布推文一样.
我目前正在使用twitter4j-core-2.1.11.jar库在Twitter上发布推文,但我也想发布一条推文文本的链接.
我该怎么办请帮忙!