Help.I发现ListView的高度,我不知道px或dpi?我需要dpi
final ListView actualListView = mPullRefreshListView.getRefreshableView();
actualListView.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
height = actualListView.getHeight();
}
});
Run Code Online (Sandbox Code Playgroud) 我的hibernate.cfg.xml
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="show_sql">true</property>
<property name="connection.url">jdbc:postgresql://localhost:5432/pirates</property>
<property name="connection.username">postgres</property>
<property name="connection.password">mmm888</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="show_sql">false</property>
<property name="hbm2ddl.auto">update</property>
<property name="current_session_context_class">thread</property>
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">200</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.generate_statistics">true</property>
Run Code Online (Sandbox Code Playgroud)
我的图书馆:
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.1.10.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-validator-4.2.0.Final.jar
jbossjta-4.16.4.Final.jar
jboss-logging-3.1.0.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
openjdk-6-b14.jar
validation-api-1.0.0.GA.jar
hibernate-c3p0-4.1.10.Final.jar
Run Code Online (Sandbox Code Playgroud)
和我的错误:
29.04.2013 14:02:43 org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator getConfiguredConnectionProviderName
WARN: HHH000208: org.hibernate.connection.C3P0ConnectionProvider has been deprecated in favor of org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider; that provider will be used instead.
29.04.2013 14:02:43 org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider
INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
Failed to create sessionFactory …Run Code Online (Sandbox Code Playgroud) 我使用选择器,我不知道如何设置文本大小.也许我做错了什么 - 帮忙
arrow.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_pressed" android:state_pressed="true" android:color="@color/green"></item>
</selector>
Run Code Online (Sandbox Code Playgroud) 我有两个活动,我使用 android:configChanges="keyboardHidden|orientation|screenSize"
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.activity_main);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
}
}
Run Code Online (Sandbox Code Playgroud)
一个主动用于纵向到第二个的横向方向, 但是当方向改变时,活动被加载并且数据丢失
如何保存数据并更改活动方向?
我使用traceView,我看到android.view.ViewRoot.handleMessage 76.4%这是什么意思?以及如何在我的源代码中找到这个bug的位置?

我正在使用ActionMode.Callback,但我需要知道文本何时被选中...例如

我不能自己决定要问的任务
我想测量ListView的高度.抓不到渲染ListView的时刻(rssListView.getHight(); = 0)
public class RSSactivity extends Activity {
public static RssItem selectedRssItem = null;
String feedUrl = "";
ListView rssListView = null;
ArrayList<RssItem> rssItems = new ArrayList<RssItem>();
ArrayAdapter<RssItem> aa = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
rssListView = (ListView) findViewById(R.id.rssListView);
aa = new ArrayAdapter<RssItem>(this, R.layout.list_item, rssItems);
rssListView.setAdapter(aa);
feedUrl = rssURLTV.getText().toString();
refressRssList();
rssListView.getWidth(); // = 0 ,
}
private void refressRssList() {
ArrayList<RssItem> newItems = RssItem.getRssItems(feedUrl);
rssItems.clear();
rssItems.addAll(newItems);
aa.notifyDataSetChanged();
}
}
Run Code Online (Sandbox Code Playgroud)
目标计算中间ListView屏幕的项目数
我不明白出了什么问题
我用了
public class UrlArrayAdapter extends BaseAdapter {...
ArrayList<UrlItem> objects;
UrlArrayAdapter(Context context, ListView urlListView,
ArrayList<UrlItem> urlLists) {
objects = urlLists; ...
//method
public void deleteItem(int numberToDelete) {
objects.remove(numberToDelete);
notifyDataSetChanged();
}
Run Code Online (Sandbox Code Playgroud)
和(最有趣的)
我得到numberToDelete = 1
然后删除该行

但对象

当numberToDelete = 0时
然后删除该行

但对象

当numberToDelete = 2时
对象

但是在notifyDataSetChanged()之后; IndexOutOfBoundException
我已经有了帖子......但我无法解决这个问题
我使用notifyDataSetChanged时IndexOutOfBoundException
stackoverflow.com/a/9260757/1568164我觉得情况就是这样,我用但不行
然后我得到一个进一步删除的位置
public View getView(int position, View convertView, ViewGroup parent) {
// Planet to display
UrlItem urlItem = (UrlItem) this.getItem(position);
ViewHolder viewHolder = null;
if (convertView == null) {
convertView = …Run Code Online (Sandbox Code Playgroud) 我在用
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv = new TextView(this);
GoogleAPI.setHttpReferrer("http://code.google.com/p/google-api-translate-java/");
GoogleAPI.setKey("AIzaSyBi7y4EgC0B-Q9UZg-tOzsOI0sLQ8F1Oow");
try {
String translatedText = Translate.DEFAULT.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH);
} catch (GoogleAPIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误,我不明白我做错了什么
02-26 10:53:53.409: W/System.err(2612):
com.google.api.GoogleAPIException: java.lang.Exception:
[google-api-translate-java] Error retrieving translation. 02-26
10:53:53.409: W/System.err(2612): at
com.google.api.translate.TranslateV2.execute(TranslateV2.java:68)
02-26 10:53:53.409: W/System.err(2612): at
com.example.testtranslate.Translator.onCreate(Translator.java:32)
02-26 10:53:53.409: W/System.err(2612): at
android.app.Activity.performCreate(Activity.java:5158) 02-26
10:53:53.409: W/System.err(2612): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-26 10:53:53.409: W/System.err(2612): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
02-26 10:53:53.409: W/System.err(2612): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
02-26 …
我该如何保存片段?(它位于活动中)当我旋转屏幕时,重新启动的活动会重新创建片段
android ×9
java ×2
baseadapter ×1
c3p0 ×1
dpi ×1
hibernate ×1
listview ×1
orientation ×1
textview ×1