I studying for many hours for nothing... I've this code that runs perfectly. The problem is button up webview. So, I see text on the webview inside button.
public class News extends Activity {
private WebView webView1;
private Button newsbutton;
private ImageView imageView1;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.news);
webView1 = (WebView)findViewById(R.id.webView1);
newsbutton = (Button)findViewById(R.id.newsbutton);
imageView1 = (ImageView)findViewById(R.id.imageView1);
webView1.setBackgroundColor(0x00000000);
webView1.loadUrl("file:///android_asset/news.html");
newsbutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
finish();
XML:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="TODO: DESCRIPTION"
android:src="@drawable/ic_launcher" />
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/imageView1" />
<Button
android:id="@+id/newsbutton"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:contentDescription="TODO: DESCRIPTION"
android:text="Chiudi" />
</RelativeLayout>
logcat
346): java.lang.StackOverflowError
E/AndroidRuntime( 346): at java.util.HashMap.doubleCapacity(HashMap.java:561)
E/AndroidRuntime( 346): at java.util.HashMap.put(HashMap.java:391)
E/AndroidRuntime( 346): at java.util.HashSet.add(HashSet.java:95)
E/AndroidRuntime( 346): at java.nio.charset.Charset.<init>(Charset.java:189)
E/AndroidRuntime( 346): at com.ibm.icu4jni.charset.CharsetICU.<init>(CharsetICU.java:33)
E/AndroidRuntime( 346): at com.ibm.icu4jni.charset.CharsetProviderICU.getCharset(CharsetProviderICU.java:62)
E/AndroidRuntime( 346): at com.ibm.icu4jni.charset.CharsetProviderICU.charsetForName(CharsetProviderICU.java:57)
E/AndroidRuntime( 346): at java.nio.charset.Charset.forNameInternal(Charset.java:500)
E/AndroidRuntime( 346): at java.nio.charset.Charset.forName(Charset.java:570)
E/AndroidRuntime( 346): at com.android.internal.util.FastXmlSerializer.setOutput(FastXmlSerializer.java:292)
E/AndroidRuntime( 346): at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:180)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl.writeFileLocked(ApplicationContext.java:2757)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl.access$800(ApplicationContext.java:2510)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2695)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3656)
E/AndroidRuntime( 346): at com.example.app.MainActivity.access$0(MainActivity.java:3632)
E/AndroidRuntime( 346): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2421)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3732)
E/AndroidRuntime( 346): at com.example.app.MainActivity.access$0(MainActivity.java:3632)
E/AndroidRuntime( 346): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2421)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3732)
E/AndroidRuntime( 346): at com.example.app.MainActivity.access$0(MainActivity.java:3632)
E/AndroidRuntime( 346): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2421)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3732)
E/AndroidRuntime( 346): at com.example.app.MainActivity.access$0(MainActivity.java:3632)
E/AndroidRuntime( 346): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2421)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3732)
E/AndroidRuntime( 346): at com.example.app.MainActivity.access$0(MainActivity.java:3632)
E/AndroidRuntime( 346): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2421)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3732)
E/AndroidRuntime( 346): at com.example.app.MainActivity.access$0(MainActivity.java:3632)
E/AndroidRuntime( 346): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2421)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3732)
E/AndroidRuntime( 346): at com.example.app.MainActivity.access$0(MainActivity.java:3632)
E/AndroidRuntime( 346): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2421)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3732)
E/AndroidRuntime( 346): at com.example.app.MainActivity.access$0(MainActivity.java:3632)
E/AndroidRuntime( 346): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2421)
E/AndroidRuntime( 346): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 346): at com.example.app.MainActivity.preferenze(MainActivity.java:3732)
E/AndroidRuntime( 346): a